Forcing Shutdown in Win2000 without using shutdown.exe

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

Hi all,

Anyone know of a way to shut Win2000 down from within a
batch file without using shutdown.exe? I figure it uses
the exitwindowsex function but unfortunately have no idea
of the syntax used.

Cheers,

Matt
 
I believe there's no way to do this without using a tool of some sort. Many
people will point to rundll32 as in "rundll32 user32,ExitWindows", however
this will not work in Windows 2000 or higher, as ExitWindows(Ex) requries
the SE_SHUTDOWN_NAME privilege, which isn't given to processes by default.
Any process which needs to shutdown Windows needs to adjust the
privileges -=before=- calling ExitWindows(Ex)

(Actually, MSDN makes no mention that ExitWindows requires SE_SHUTDOWN_NAME,
however the clever will note that ExitWindows() is #defined to ExitWindowsEx
in WinUser.h).

Long story short, you're going to need shutdown.exe (or another tool, such
as one you write yourself).
 
Back
Top