impossible to reboot OS in python?

Mark Hammond mhammond at skippinet.com.au
Fri Feb 15 20:41:23 EST 2002


Kris Botha wrote:
> I heard it was impossible to induce a reboot in python as the os module does
> not cater for that. Is this true?

Yes.

> I know in DOS you could just set a hex value at the correct address to
> induce a cold or warm reboot, but this won't work for windows machines.

Correct.

> Does it depend on the os installed?

Yes.

For Windows NT/2000, do a google search - I have posted code that does 
this a number of times.

For Win9x, MSDN documents that you can execute:

rundll32.exe shell32.dll,SHExitWindowsEx n

where n is one, or a combination of, the following numbers:

0 - LOGOFF
1 - SHUTDOWN
2 - REBOOT
4 - FORCE
8 - POWEROFF

See other replies for *nix.

Mark.





More information about the Python-list mailing list