Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging off

Status
Not open for further replies.

celsis

IS-IT--Management
Feb 8, 2001
8
0
0
IE
Apologies if this has been up before, but does anyone know of a batch/script file that can be used to shut down a local machine, instead of going through START/SHUTDOWN?

I used to have one on my machine until I had to change the HDD and I've forgotten where I got it from.

Cheers,

Mike
 
I couldn't view the FAQ, so I'll post this:

Via the SHExitWindowsEx
Using the User.exe & User32.dll Exit Windows functions doesn't allow any control over what type of shutdown is preformed as parameters aren't passed, they operate as if 0 is passed - which is shutdown for ExitWindows and Logoff for ExitWindowsEx. An undocumented function SHExitWindowsEx in Shell32.dll which is what Explorer seems to use does take parameters.

rundll32.exe shell32.dll,SHExitWindowsEx [optional number in hex]
Action Value in Hex
EWX_LOGOFF 0
EWX_SHUTDOWN 1
EWX_REBOOT 2
EWX_FORCE 4
EWX_POWEROFF
for machines that turn off their own power 8

These values can be added together, eg, 5 is shutdown and force applications to close and an implicit logoff.

reghakr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top