/build/static/layout/Breadcrumb_cap_w.png

Vbscript - having trouble constructing a run command

I am having trouble constructing a run command using a variable derived from currentDirectory. I have so far:

strDir=wshShell.CurrentDirectory
restofpath = "\SourceFiles\desktop.exe /silent"

newpath = strDir & restofpath

When I echo out newpath, I have the path to the executable and the switch perfectly.

I would like to construct a wshell.run command using the newpath variable and 8, True at the end of the statement. I have tried numerous formats and I keep getting the error 'The system cannot find the file specified.' and I think I just don't have enough experience with Vbscript formatting to find the right combination.

Any help would be appreciated.

0 Comments   [ + ] Show comments

Answers (3)

Posted by: the.fly 19 years ago
Senior Yellow Belt
0
Also, as a continuation of the same problem. I need to run a second command with using the same CurrentDirectory variable but with the additional problem of having to use a parameter for the execuatable that must contain "" around a staement. The parameter is -uncpath=C:\test\tets1\test2" -silent. I think this one will be even harder to construct a run command.
Posted by: the.fly 19 years ago
Senior Yellow Belt
0
I have figured out the first problem![8|] But the second run command is harder. Let me see if I can restate it better:

Here is an example of what works at the command prompt:

c:\test\test1\test2\SourceFiles\eau.exe -uncpath="c:\test\test1\test2\SourceFiles" -silent

I am having two issues: The first is that the path 'c:\test\test1\test2' in both parts of the run command will not be hard coded, it will be ascertained through the CurrentDirectory function.
The second issue is that the variable ascertained from CurrentDirectory also sits in between quotes.

I hope this explains it a bit better.
Posted by: WiseUser 19 years ago
Fourth Degree Brown Belt
0
It should look something like this...

Set oWsh = CreateObject("Wscript.Shell")

sScriptDir = Replace(Wscript.ScriptFullName, Wscript.ScriptName, "")

oWsh.Run Chr(34) & sScriptDir & "\SourceFiles\eau.exe" & Chr(34) & " -uncpath=" & Chr(34) & sScriptDir & "\SourceFiles" & Chr(34) & " -silent"
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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