/build/static/layout/Breadcrumb_cap_w.png

vbscript in WIndows 7 64 bit machine

I use the following script to make sure the error is not given while running a SCCM program. I am not able to use in a 64 bit machine. test.cmd has the command to execute the program.Can someone help ?

Dim WshShell, UIv
Set WshShell = Wscript.CreateObject("Wscript.Shell")
On Error Resume Next


UIv = "test.cmd"


WshShell.Run UIv,1,True


If (Err.Number = 0) OR (Err.Number = 1605) Then
  WScript.Quit(0)
End If
Set WshShell = Nothing

0 Comments   [ + ] Show comments

Answers (2)

Posted by: aragorn.2003 9 years ago
Red Belt
1
Hi ninjaguy,

it´s working but better change the object declaration to

Set WshShell = CreateObject("Wscript.Shell")

but why do you put the command to execute the program in a command file and not in this vbs too.

WshShell.Run "%COMSPEC% /k ipconfig /all", 0, True
Posted by: anonymous_9363 9 years ago
Red Belt
0

I can't be sure but this might be for the same reason which causes scripts to fail to run "inside" MSIs, viz. that the environment doesn't "know" what Windows Scripting Host is. Try changing this:

Set WshShell = Wscript.CreateObject("Wscript.Shell")

to this:

Set WshShell = CreateObject("Wscript.Shell")

For forum etiquette, please apply the 'Code' style to your code fragment, as I have done here.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ