A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » Customizing Windows XP
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Shortcut icon for "SHUTDOWN"



 
 
Thread Tools Display Modes
  #1  
Old April 14th 03, 09:27 PM
Torgeir Bakken (MVP)
external usenet poster
 
Posts: n/a
Default Shortcut icon for "SHUTDOWN"

"JEFF B." wrote:

Is there a way to create a shortcut icon to shutdown my
computer instead of following the 3 steps needed to get to
Shutdown in XP? I don't know where the "shutdown.exe" (or
whatever it may be called) is. Thanks for any info! Jeff


Hi

One downside sometimes with the shutdown.exe that comes with WinXP,
on a lot of computers you end up with "It is now safe to turn off your
computer"
and you will need to use the power button to power off...

To avoid that you can use one of the free utilities listed below instead of
shutdown.exe:

PsShutdown.exe in the PsTools suite
http://www.sysinternals.com/ntw2k/fr.../pstools.shtml

PowerOff
http://www.stefan-kuhr.de/poweroff/main.php3

Wizmo.exe
http://grc.com/wizmo/wizmo.htm

Search for
poweroff at http://download.com.com/

Poweroff 3.0 is one of the possibilities.


Using VBScript/WMI works very well, put the following code into a file called
e.g. shutdwn.vbs, run it with wscript.exe path-to-vbs-file:


' sleep 30 minutes (time in millisec)
Wscript.Sleep 1800000

' use "." for local computer
' Use "PowerOff_Force" for a forced poweroff
ShutDown ".", "PowerOff"


Sub ShutDown(sNode, sAction)

Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8

Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\ \" _
& sNode & "\root\cimv2")

Set colOperatingSystems = oWMI.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each obj in colOperatingSystems
Set oOS = obj : Exit For
Next

sAction = LCase(sAction)

Select Case sAction
Case "logoff"
iCmd = EWX_LOGOFF
Case "logoff_force"
iCmd = EWX_LOGOFF + EWX_FORCE
Case "shutdown"
iCmd = EWX_SHUTDOWN
Case "shutdown_force"
iCmd = EWX_SHUTDOWN + EWX_FORCE
Case "reboot"
iCmd = EWX_REBOOT
Case "reboot_force"
iCmd = EWX_REBOOT + EWX_FORCE
Case "poweroff"
iCmd = EWX_POWEROFF
Case "poweroff_force"
iCmd = EWX_POWEROFF + EWX_FORCE
Case Else
' Default value
iCmd = EWX_POWEROFF
End Select

oOS.Win32shutdown iCmd
End Sub

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Ads
  #2  
Old April 14th 03, 10:01 PM
nemesis
external usenet poster
 
Posts: n/a
Default Shortcut icon for "SHUTDOWN"

Right-click on the Desktop and choose New | Shortcut from
the pop-up menu and paste this into the box %windir%
\System32\shutdown.exe -s -t 00
click next now name the shortcut Shutdown and then click
finished now right click on the new shortcut and then gogo
properties click on the change icon and select the
shutdown icon from shell32.dll
-----Original Message-----
"JEFF B." wrote:

Is there a way to create a shortcut icon to shutdown my
computer instead of following the 3 steps needed to get

to
Shutdown in XP? I don't know where the "shutdown.exe"

(or
whatever it may be called) is. Thanks for any info! Jeff


Hi

One downside sometimes with the shutdown.exe that comes

with WinXP,
on a lot of computers you end up with "It is now safe to

turn off your
computer"
and you will need to use the power button to power off...

To avoid that you can use one of the free utilities

listed below instead of
shutdown.exe:

PsShutdown.exe in the PsTools suite
http://www.sysinternals.com/ntw2k/fr.../pstools.shtml

PowerOff
http://www.stefan-kuhr.de/poweroff/main.php3

Wizmo.exe
http://grc.com/wizmo/wizmo.htm

Search for
poweroff at http://download.com.com/

Poweroff 3.0 is one of the possibilities.


Using VBScript/WMI works very well, put the following

code into a file called
e.g. shutdwn.vbs, run it with wscript.exe path-to-vbs-

file:


' sleep 30 minutes (time in millisec)
Wscript.Sleep 1800000

' use "." for local computer
' Use "PowerOff_Force" for a forced poweroff
ShutDown ".", "PowerOff"


Sub ShutDown(sNode, sAction)

Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8

Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\ \" _
& sNode & "\root\cimv2")

Set colOperatingSystems = oWMI.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each obj in colOperatingSystems
Set oOS = obj : Exit For
Next

sAction = LCase(sAction)

Select Case sAction
Case "logoff"
iCmd = EWX_LOGOFF
Case "logoff_force"
iCmd = EWX_LOGOFF + EWX_FORCE
Case "shutdown"
iCmd = EWX_SHUTDOWN
Case "shutdown_force"
iCmd = EWX_SHUTDOWN + EWX_FORCE
Case "reboot"
iCmd = EWX_REBOOT
Case "reboot_force"
iCmd = EWX_REBOOT + EWX_FORCE
Case "poweroff"
iCmd = EWX_POWEROFF
Case "poweroff_force"
iCmd = EWX_POWEROFF + EWX_FORCE
Case Else
' Default value
iCmd = EWX_POWEROFF
End Select

oOS.Win32shutdown iCmd
End Sub

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version

of the 1328 page
Scripting Guide:

http://www.microsoft.com/technet/scriptcenter


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 03:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.