|
Answer» There are a lot more of the following if statments...
if %username% EQU 121716 GOTO skip if %username% EQU 121726 GOTO skip if %username% EQU 121703 GOTO skip cd c:\ shutdown /r /t 99 /c "If you are WORKING at this workstation inform the lab monitor immediately" :skip exit
Can anyone explain why this batch WOULD work properly on one computer and every other computer it is on locks up?
when i turn echo off I see that it gets passed all the IF statements and does the c:\shutdown /r /t 99 /c "If you are working at this workstation inform the lab monitor immediately" at the prompt but then the batch is stuck and can only be closed manually and no restart occurs.
the batch is running under winxpif one of the "if" statements is true it runs properly and exits.Switches for shutdown are passed as -r -t -c, not with forward SLASHES. Also isn't shutdown in the c:\windows\system32 directory?
Just a small thought, but if the system actually carries out the shutdown, you really don't need to exit the command window.
changing it to the system32 directory fixed it.
I guess one of the other people took out paths so programs couldn't be easily ran from the prompt.
but i've never had a PROBLEM with / switches
I use them in all my batches and they work fine for me.
almost all ? DESCRIPTIONS do give a - switch but i just use / since it's easier.i'm not sure what your system runs or not, but i know that with the systems that i use, you don't have to even go to the c:/windows/system32 directory, you can just use the command as it is, such as a batch file would be
@echo off shutdown -t 99 -r -s -c "this is the comment" end
or something like that....
|