Automation Question: How do you stop a process from a .bat file?
There is a program on running utilizes a service to connect to a special USB device. If the application terminates then it leaves the service running. When the program is run again then it fails to connect to its hardware. I have noticecd that if I manually terminate the service and then run the program, then it restarts the service and always connects to the hardware. I have told the manufacturer for this problem, but as a temporary workaround I want to launch the program using a bat file and when it terminates, the bat file will stop the service. Can anyone please help? Thanks
Re: Automation Question: How do you stop a process from a .bat fil
Thank you, I have checekd the XNETS which is the name of the service, and it does work in the script file.
Re: Automation Question: How do you stop a process from a .bat fil
You can also try to use "sc stop" instead of "net stop". For processes, download the Process Utility tool. Below are the Command Line Process Viewer/Killer/Suspender
Usage:
ProcessUtility.exe [-v] [-t] [-c]
ProcessUtility.exe [-q] [Process Name/PID] [timeout sec(optional)]
ProcessUtility.exe [-k] [-s] [-r] [Process Name/PID]
ProcessUtility.exe [-p] [Process Name/PID]
{RealTime|High|AboveNormal|Normal|BelowNormal|Low}
ProcessUtility.exe [-a] [Process Name/PID] [Mask(To Set)]
-v View Processes.
-t View Kernel and User CPU Times.
-c View Process Creation Times.
-q Send WM_CLOSE Message. Default timeout is 60 Sec
-k Kill Process. (Terminate)
-s Suspend Process.
-r Resume Suspended Process.
-p Set Process Priority.
-a Get/Set Affinity Mask of Process.
PROCUTIL -q [PID] 5
Re: Automation Question: How do you stop a process from a .bat fil
Thanks for that, I will try to do what you have suggested, since I have a script file that works most of the time, occasionally it fails to stop Xnets.