Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Automation Question: How do you stop a process from a .bat file?

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 05-08-2008
Member
 
Join Date: Sep 2005
Posts: 175
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

Reply With Quote
  #2  
Old 05-08-2008
Member
 
Join Date: Nov 2005
Posts: 609
Normally, the xnets.exe is the name of the executable, not necessarily the service name. The service name is shown in the list of services; right click on a service and click properties and then the service name is shown. When the service name has blanks in it, then you will have to use double quotation marks in the "net stop" command, for example - net stop "service name".
Reply With Quote
  #3  
Old 05-08-2008
Member
 
Join Date: Sep 2005
Posts: 175
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.
Reply With Quote
  #4  
Old 06-08-2008
Member
 
Join Date: Sep 2005
Posts: 1,306
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
Reply With Quote
  #5  
Old 12-08-2008
Member
 
Join Date: Sep 2005
Posts: 175
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.
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags:



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Automation Question: How do you stop a process from a .bat file?"
Thread Thread Starter Forum Replies Last Post
Automation of Word and background process mutually fails Gechina Operating Systems 6 19-04-2011 11:36 PM
Cannot stop Process Respawns Inception Operating Systems 3 12-01-2011 03:06 AM
Question about Upgrading Process of Thinkpad T60 Illinois Portable Devices 6 23-06-2010 07:03 AM
How to Stop the Windows Shutdown Process Apacer Operating Systems 3 23-05-2009 07:39 PM


All times are GMT +5.5. The time now is 09:16 AM.