/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


vbscript in WIndows 7 64 bit machine

03/04/2015 2812 views
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

Comments



Community Chosen Answer

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
Answered 03/04/2015 by: aragorn.2003
Red Belt

All Answers

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.

Answered 03/04/2015 by: VBScab
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
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