Solved need to close the batch window

April 30, 2015 at 03:16:22
Specs: Windows 7
taskkill kills the cmd.exe process but not closing the batch window

taskkill /f /FI "WINDOWTITLE eq title" /FI "IMAGENAME eq cmd.exe";


See More: need to close the batch window

Report •


✔ Best Answer
May 6, 2015 at 09:26:32
Okay, here's the deal. While a window and a process are tied together, a process is a system wide object, whereas a processes window is tied to a desktop. Given Window's native scripting languages, only PowerShell has the ability to match a window to its process, and only with heavy use of P/Invoke.

I would recommend you modify your script to start your java process in the background, and keep track of the PID. Then your script could wait for that event, and kill the java process via the PID. This may not be feasible; it depends on your setup and this unspecified event.

How To Ask Questions The Smart Way



#1
May 1, 2015 at 01:47:03
It may help to post the batch.

Or it may not.

=====================

M2 Get custom script or take private lessons


Report •

#2
May 1, 2015 at 05:56:09
title test
set rmi_host=localhost
set rmi_registry_port=8888
set rmi_codebase=%path%/fpmiddleware.jar
set log4j_path=%path%/log4j.jar
set cis_path=%path%/FP_NB_1%path%/cis.jar;%path%/odsdb.jar;%path%/TmBackbusObjects.jar%path%/TmDataAdapter.jar;%path%/TmNativeObjects.jar;%path%/TmODSS.jar;%path%/TmUtils.jar;%path%/FpAdapter.jar;%path%/jdom.jar;%path%/xercesImpl.jar;%path%/lib;%path%/zql.jar;%path%/ojdbc14.jar;%path%/odsi18n.jar
set cis_util_path=%path%/cis-util.jar
set launcher=Ln_Br_FP_NB_1_launcher

rem setting java home
set JAVA_HOME=%path%/j2sdk1.4.2_13

set jvm_args=-Xmx1390m

rem setting path for jdk
set PATH=%path%/bin;%path%/bin;%PATH%

rem setting classpath to run launcher class
rem set CLASSPATH=.;%rmi_codebase%;%log4j_path%;%cis_path%;%cis_util_path%
set CLASSPATH=%path%\config;.;%rmi_codebase%;%log4j_path%;%cis_path%;%cis_util_path%

rem starting registry on port %rmi_registry_port%
start rmiregistry %rmi_registry_port%

rem starting launcher to listen on that port
java -Djava.rmi.server.codebase=file:///%rmi_codebase% -Djava.rmi.server.hostname=%rmi_host% -Djava.security.policy=java.policy com.i2.fp.RMI.FPRMILauncherImpl -launch_lag 1 -launcher_name %launcher% -rmi_registry_port %rmi_registry_port% -max_exec_time 300 -jvm_args %jvm_args%

exit


Report •

#3
May 1, 2015 at 08:33:49
I'm still not sure what you're trying to accomplish. Perhaps some explanation of the current behavior, and what you're trying to do?

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
May 1, 2015 at 09:20:22
this is batch file to run a particular process. I need to close this batch file from another batch file after some event using the window title. that is why I am using taskkill but taskkill is able to terminate the process bt the command window does not get off.

Report •

#5
May 6, 2015 at 09:26:32
✔ Best Answer
Okay, here's the deal. While a window and a process are tied together, a process is a system wide object, whereas a processes window is tied to a desktop. Given Window's native scripting languages, only PowerShell has the ability to match a window to its process, and only with heavy use of P/Invoke.

I would recommend you modify your script to start your java process in the background, and keep track of the PID. Then your script could wait for that event, and kill the java process via the PID. This may not be feasible; it depends on your setup and this unspecified event.

How To Ask Questions The Smart Way


Report •


Ask Question