Computing Staff
  • 0

Restart Service On List Of Computers From Txt File

  • 0

I have a list of computers in a txt file that I want to be able to stop and start a running service on them. How can I accomplish that?

Share

1 Answer

  1. Hello,
    If you are looking for an easy solution for WinXP/2003 through Win8/2012 that has not external dependencies, like enabling PowerShell script execution or installing/copy program files, then using the CMD.EXE prompt’s FOR command is the best bet.

    :: A one line batch file 
    for /F %%i in (computerlist.txt) do ( @sc \\%%i stop "SERVICE NAME" )
    
    :: Same one liner but direct at command prompt
    for /F %i in (computerlist.txt) do ( @sc \\%i stop "SERVICE NAME" ) 

    • 0