Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
Sys Function - Shutdown XPThis function shuts down an XP machine. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Sub zSys_ShutdownXp(iDelay, sComment) 'XP Shutdown 'Usage: 'Call zSys_ShutdownXp(iDelay, sComment) 'Where 'iDelay is the delay in seconds before performing the shutdown 'sComment is a comment displayed and written to the event log 'Parameters '-s = shutdown '-f = close programs without warning '-c = shutdown comment (max 127 characters) '-t nn = time until shutdown in seconds '-d :4 :5 = reason = unplanned application unresponsive Dim oShell, sCommand sCommand = "C:\WINDOWS\system32\shutdown.exe -s -f -d :4:5 -t " & cStr(iDelay) & " -c " & Chr(34) & sComment & Chr(34) Set oShell = CreateObject("WScript.Shell") oShell.Run sCommand Set oShell = Nothing End Sub '========================================================================= |