Discussion Locked

Turning off a computer

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hey all...

I am just wondering if there is any way to turn off/Restart/Hibernate a computer using DOS or batch file??
Any enlightment would be greatly appretiated

thank you!!

6 replies

by craig herberg

To shutdown:
shutdown -s
To restart:
shutdown -r

If you are using Win XP, you can type them from a command prompt or put in a batch file.

Craig Herberg

by chromacat

If you are using XP, you can also create shortcuts that work for shutting down and restarting.

Shutdown shortcut:

%windir%\system32\SHUTDOWN.exe -s -t 01

Restart shortcut:

%windir%\system32\SHUTDOWN.exe -r -t 01

The -t option is the timeout before the shutdown/restart occurs.

You can grab an icon if you like from:
%SystemRoot%\system32\SHELL32.dll

Cheers,
DD

by nipun_5758

aah great info... i will try it... any way to put system to hibernate???

also i was trying to make a bat file for shut down and reboot,, how do i go about doing that..

I got 2 machines with XP and 2000...

For 2000 i tried:
in notepad i wrote -- shutdown -r (for restart) and saved file as reboot.bat
when i run that bat file it doesnt do anything... just opent he cmd and closes it real quick...

please help

by humanonomics

Try running the bat file using dos via command window, this will help you in identifying the problem, and see if any error/exception is thrown by the operating system.

thanks.

by Member 25348569

sComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & sComputer & "\root\cimv2")
Set colOS = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")

For Each objOS in colOS
objOS.Reboot ()
Next
----------------------------

Save the lines about as 'reboot.vbs' and add it to the scheduled task list on every machine that you want to reboot. If you change the sComputer from . (local system) to something else, this will reboot a remote system.

This discussion is closed to new replies.