Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I simulate running a .exe file from the Run box in windows ?? 2

Status
Not open for further replies.

Pyro777

MIS
Jul 14, 2006
47
US
Here is the issue... I have a package that is very quirky.. It will not run from my script or a command prompt, but if I run it from the Start\Run command it works fine....

Dont get me wrong, the .exe file will start to run but it will error out after it first initializes...
Here is part of my script:

Dim objshell
Set objshell = WScript.CreateObject ("WScript.Shell")

objshell.Run "\\MyServerName\smspkg\SMo000A1\urc11_2.exe", 1, True

Once this part of the script runs, the script will then upgrade the package... I have tried adding the """ in the beginning and end of the script but get the same results
 
Have you tried using objShell.Exec instead?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
You may also try something like this:
Code:
strProg = "\\MyServerName\smspkg\SMo000A1\urc11_2.exe"
objshell.Run "start /wait """ & strProg & """, 1, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank both of you for your help... I was working on it late last night and finally found that if I was to set the current directory, the application would be fooled in believing it was launched from that directory and not from a command prompt. By using objshell.currentdirectory = "\\MyServerName\smspkg\SMo000A1\" I was able to make that work... I do have quite a bit of scripting to do and plan to try your solutions as I go, ya can never learn to much about scripting as I learn every day !!!!


Here what I finally came up with...

objshell.currentdirectory = "\\MyServerName\smspkg\smo000a1"
OBJshell.Run chr(34)&"\\MyServerName\smspkg\smo000a1\urc11_2.exe"&chr(34), 1, True

You both have been so much help to me and I plan to give you stars again for you help !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top