
Can I shutdown computer with WSH?
FYI: It depends on your operating system. In Win 9x use:
'************************************************
' File: RunExit.vbs (WSH sample in VBScript)
' Author: Gnter Born
'
' Uses the Run method to call the Windows 95/98
' ExitWindows API function.
'************************************************
'
DIM WshShell
Set WshShell = WScript.CreateObject ("WScript.Shell")
If (MsgBox ("Shutdown Windows 95/98", vbYesNo + vbQuestion, _
"WSH sample - by Gnter Born") = vbYes) Then _
WshShell.Run _
"%windir%\RunDll32.exe user,ExitWindows", 1, -1
WScript.Quit
' End
In Win NT/Win 2000 you can shell out a command with Run
to use tools like SHutdown.exe, or you can use third party
ActiveX controls (see Ian Morrish's website - links on the
WSH Bazaar).
G. Born
--
____________________________________________
Check out the WSH Bazaar at:
www.borncity.de
eric schrieb in Nachricht ...
Quote:
>I want to write a vbscript to shutdown the computer?