• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Really dumb VB question....

Mainframeguy

Debiant by way of Ubuntu
#1
Maybe I am being too lazy to find out (I do code, just not in VB!)

But is the following a valid script to shutdown windoze XP (I have delimited with <start> and <end> - rest is pasted right out of file)...

<start>
'Begin shell script code'
set WshShell = CreateObject("WScript.Shell")

WshShell.Run "c:\windows\system32\cmd.exe"


'Wait until cmd.exe has loaded'
While WshShell.AppActivate("c:\windows\system32\cmd.exe") = FALSE
wscript.sleep 1000
Wend

'Bring cmd.exe to the foreground'
WshShell.AppActivate "c:\windows\system32\cmd.exe"

'Change directories and issue shutdown command
WshShell.SendKeys "cd{\}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "cd windows{\}system32"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "shutdown -s"
WshShell.SendKeys "{ENTER}"

'End shell script code'
<end>

incase you wonder why... I am trying to run this when MBM jits a temperature trigger that makes my system unstable - it is not the best script, a warning window to close apps would be kind!, but I thought it was s start.... I know you guys will tell me all about it...
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,962
Messages
673,240
Members
89,017
Latest member
keithgonzaal