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

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


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


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.
Answered 09/29/2005 by: the.fly
Senior Yellow Belt

Please log in to comment
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.
Answered 09/29/2005 by: the.fly
Senior Yellow Belt

Please log in to comment
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"
Answered 09/29/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity