Batch file - server name

  • Thread starter Thread starter BK
  • Start date Start date
B

BK

Hi,

I've had a look about on google for this - no joy.

I'm trying to create a batch file that patches various
servers. I'd like to read the server name/ip address from
a text file, so we don't have to do each one manually.
How can I do this?

Thanks
 
This is what I've got so far - its not retreving the
server names though. Pause is in there for testing.

@ECHO OFF
FOR /F "tokens=*" %%a in (ServerList.txt) Do CALL :DoTask %
%a
Goto :exit

:DoTask
psexec \\%CurrentServer% -u id -p password -c
unattendedqchain.exe
pause
psshutdown -u id -p password -f -r \\%CurrentServer%
SET CurrentServer=%*
:exit
 
Maybe move the SET statement for CurrentServer before its
first use in the subroutine or simply use the %* argument
instead.

Tom Lavedas
===========
 
Back
Top