logging results of a batch file in a .txt file

Associate
Joined
1 Apr 2008
Posts
1,585
Location
UK
Hi all, i hope someone can help me.

I have recently created a batch file to remotely shutdown PCs on a network which so far appears to be working ok.

My question is, is there a way to log the results of the batch file (so i can check what machines shutdown or did not respond) into a .txt or .log file? I'm sure i've done this in the past but i can't recall how i did it....

Anyhelp would be greatly appreciated :)
 
right ok i've given that a go and while it does log all "network can not be found" messages it does not tell me the machine names so i don't know which machines are inaccessible.

Do you know of any way to log all the information? Even it means having to log the entire batch process including commands.

I'm feeling a bit slow today i think the Macclesfield air is getting to me so sorry for all of this lol

Thanks :)
 
i'm using "shutdown"

I'll give you a quick example of what i'm using:

@Echo Off

cd\
Echo ========
Echo Test
Echo ========

Pause

set varcomputer=RANDOM1
goto loop
:RANDOM1

set varcomputer=RANDOM2
goto loop
:RANDOM2

Exit

:loop
echo Shutting down %varcomputer%.
shutdown -s -f -m \\%varcomputer% -t 60 -c "TEST SHUTDOWN" >> log.txt
goto %varcomputer%

I don't think i've missed anything there....
 
Back
Top Bottom