gisvpn
asked on
Batch file to restart PC
Is it possible to write a batch file which restart my computer ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If it makes a difference please could you let me know for the following (",)
Windows XP
Windows 2000
Windows 98
Windows 95
Windows NT
Thank you.. Have increased the points :)
Windows XP
Windows 2000
Windows 98
Windows 95
Windows NT
Thank you.. Have increased the points :)
In windows 9x/ME:
@start "C:\WINDOWS\RUNDLL32.EXE user,exitwindows"
See other examples here: http://www.robvanderwoude.com/index.html
@start "C:\WINDOWS\RUNDLL32.EXE user,exitwindows"
See other examples here: http://www.robvanderwoude.com/index.html
My last post is for many operating systems and scripts.
Just simply create a batch file with the appropriate command in it...
Just simply create a batch file with the appropriate command in it...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another good link: http://home.wanadoo.nl/scripting/topics/f10/ultimatebb.cgi-ubb=print_topic;f=10;t=000035.htm
Win31:
ECHO G=FFFF:0000 ¦ DEBUG
Win9x:
RUNDLL USER.EXE,ExitWindows
RUNDLL USER.EXE,ExitWindowsExec
Win9x/ME:
RUNDLL32 SHELL32.DLL,SHExitWindowsE x n
(where n=1 to shutdown. 0=Logoff, 2=Reboot, 8=PowerOff (if hardware supported)
NT(/2K):
RUNDLL32 USER32.DLL,ExitWindowsEx
(with ResourceKit):
SHUTDOWN /L /T:10 /Y /C
XP (/2k with resource kit):
SHUTDOWN -s -t 01
Using KIX:
$RC = SHUTDOWN( "\\server", "Shutting down...", 10, 1, 0 )
Win31:
ECHO G=FFFF:0000 ¦ DEBUG
Win9x:
RUNDLL USER.EXE,ExitWindows
RUNDLL USER.EXE,ExitWindowsExec
Win9x/ME:
RUNDLL32 SHELL32.DLL,SHExitWindowsE
(where n=1 to shutdown. 0=Logoff, 2=Reboot, 8=PowerOff (if hardware supported)
NT(/2K):
RUNDLL32 USER32.DLL,ExitWindowsEx
(with ResourceKit):
SHUTDOWN /L /T:10 /Y /C
XP (/2k with resource kit):
SHUTDOWN -s -t 01
Using KIX:
$RC = SHUTDOWN( "\\server", "Shutting down...", 10, 1, 0 )
ASKER
Sirbounty
Do you know how to install the DevCon Command Line utility onto a Windows 2000 PC ?
I have downloaded the .ZIP file from Microsoft however Devcon does not work... cant find any install instructions from MS ?
Can you help ?
Thanks Ollie
Do you know how to install the DevCon Command Line utility onto a Windows 2000 PC ?
I have downloaded the .ZIP file from Microsoft however Devcon does not work... cant find any install instructions from MS ?
Can you help ?
Thanks Ollie
The package should be an EXE: http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe
ASKER
Hi Sirbounty.
Thanks for the link.. for some reason if you download it from here http://support.microsoft.com/?kbid=311272 it gives you a .exe which contains 3 zipped files.
Apparently you have to unzip these and place them in PATH ( C:WINNT\system32 ).
Works great now..
However, with Devcon Reboot, how can i add a delay to the reboot ?
Thanks for the link.. for some reason if you download it from here http://support.microsoft.com/?kbid=311272 it gives you a .exe which contains 3 zipped files.
Apparently you have to unzip these and place them in PATH ( C:WINNT\system32 ).
Works great now..
However, with Devcon Reboot, how can i add a delay to the reboot ?
I dont' know that it has a native way of delaying the reboot...(try Devcon /? or Devcon Help)
Otherwise, place a 'homemade' timer before the reboot:
------------------
ping 127.0.0.1 -n 25
devcon restart
-------------------
(ping's localhost 25 times before continuing
Otherwise, place a 'homemade' timer before the reboot:
------------------
ping 127.0.0.1 -n 25
devcon restart
-------------------
(ping's localhost 25 times before continuing
ASKER
ok thank you :)
My two cents.
Windows 95 is notorious for not restarting with a RUNDLL command. If you want to reboot a Win95 PC from a batch file, you might want to look at:
http://www.rjlsoftware.com/software/utility/shutdown/
This is for a simple shutdown utility that will work from the command line and its free.
I tried it with a batch file and it worked beautifully.
It also works with just about every Win version.
Windows 95 is notorious for not restarting with a RUNDLL command. If you want to reboot a Win95 PC from a batch file, you might want to look at:
http://www.rjlsoftware.com/software/utility/shutdown/
This is for a simple shutdown utility that will work from the command line and its free.
I tried it with a batch file and it worked beautifully.
It also works with just about every Win version.
So, to take this batch file creation theme one step further, I assume it's possible to write a scheduled restart batch file...in other words, a restart batch file that gets executed at a specific time. Does anyone have any ideas on what the best way would be?
Before the question gets asked, this is specifically for Windows XP (Pro).
thanks for any and all input,
JDH
Before the question gets asked, this is specifically for Windows XP (Pro).
thanks for any and all input,
JDH
XP includes a shutdown command...
SHUTDOWN /? from a command prompt should get you started...
SHUTDOWN /? from a command prompt should get you started...
yes, I already know the correct command...it is: shutdown -r -f
My question was not what command to use, but rather HOW to write a batch file that would be automatically run at a particularly time. So, what to put IN the batch file and how to make it run at regularly recurring intervals (similar to a cron-job in UNIX)?
Can anyone offer any suggestion?
JDH
My question was not what command to use, but rather HOW to write a batch file that would be automatically run at a particularly time. So, what to put IN the batch file and how to make it run at regularly recurring intervals (similar to a cron-job in UNIX)?
Can anyone offer any suggestion?
JDH
Don't recall cron-job myself, but just use task scheduler to schedule it - your batch file would include the line you've stated above...
If you need further assistance, you're better off opening a new question, see: http:help.jsp#hi107
If you need further assistance, you're better off opening a new question, see: http:help.jsp#hi107
Yeah, you're right....my bad. I think you have answered my question though, so thank you.
-You're the man, Senior Bounty!
JDH
-You're the man, Senior Bounty!
JDH
: )
Happy to help..
Happy to help..
You can do this in most OSs...
Try shutdown /? from a command line to get an idea...