Can I shutdown computer with WSH? 
Author Message
 Can I shutdown computer with WSH?

I want to write a VBScript to shutdown the computer?


Sat, 28 Sep 2002 03:00:00 GMT  
 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?



Sat, 28 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to shutdown the computer with WSH

2. Shutdown Computer using VBScript

3. Shutdown computer?

4. Rerun a program automatically in wsh if it dies or is shutdown

5. Shutdown using WSH??

6. Unable to Shutdown Windows95 & reboot via WSH

7. Rerun a program automatically in wsh if it dies or is shutdown

8. Remote shutdown using wsh

9. Shutdown within WSH

10. running WSH cript on remote computer

11. Installing wsh on a computer that doesn't have it

12. Adding computer to domain using WSH?

 

 
Powered by phpBB® Forum Software