Results 1 to 5 of 5

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

  1. #1
    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

  2. #2
    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".

  3. #3
    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.

  4. #4
    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

  5. #5
    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.

Similar Threads

  1. Automation of Word and background process mutually fails
    By Gechina in forum Operating Systems
    Replies: 6
    Last Post: 19-04-2011, 10:36 PM
  2. Cannot stop Process Respawns
    By Inception in forum Operating Systems
    Replies: 3
    Last Post: 12-01-2011, 03:06 AM
  3. Question about Upgrading Process of Thinkpad T60
    By Illinois in forum Portable Devices
    Replies: 6
    Last Post: 23-06-2010, 06:03 AM
  4. How to Stop the Windows Shutdown Process
    By Apacer in forum Operating Systems
    Replies: 3
    Last Post: 23-05-2009, 06:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,726,420.78869 seconds with 17 queries