windows - Batch - Reboot computer if a batch file ends -
essentially have 2 batch files, 1 "wrapper" if will, calling batch file starts /min (minimized). batch file ends once has launched 2nd batch file.
this contains loop, keeps spawning rdp session after closed.
the problem is, if user alt-tabs , closes batch, left empty desktop (as task kill explorer). there way of force rebooting machine if batch loop ends?
thanks!
there standard cmd command:
shutdown /r usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f] [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] no args display help. same typing /?. /? display help. same not typing options. /i display graphical user interface (gui). must first option. /l log off. cannot used /m or /d options. /s shutdown computer. /r full shutdown , restart computer. /g full shutdown , restart computer. after system rebooted, restart registered applications. /a abort system shutdown. can used during time-out period. /p turn off local computer no time-out or warning. can used /d , /f options. /h hibernate local computer. can used /f option. /hybrid performs shutdown of computer , prepares fast startup. must used /s option. /e document reason unexpected shutdown of computer. /o go advanced boot options menu , restart computer. must used /r option. /m \\computer specify target computer. /t xxx set time-out period before shutdown xxx seconds. valid range 0-315360000 (10 years), default of 30. if timeout period greater 0, /f parameter implied. /c "comment" comment on reason restart or shutdown. maximum of 512 characters allowed. /f force running applications close without forewarning users. /f parameter implied when value greater 0 specified /t parameter. /d [p|u:]xx:yy provide reason restart or shutdown. p indicates restart or shutdown planned. u indicates reason user defined. if neither p nor u specified restart or shutdown unplanned. xx major reason number (positive integer less 256). yy minor reason number (positive integer less 65536).
Comments
Post a Comment