skyline
-
Total Posts
:
77
- Scores: 3
-
Reward points
:
0
- Joined: 3/14/2011
-
Status: offline
|
Running an .exe file with spaces in file path...
Saturday, March 19, 2011 3:14 PM
( permalink)
Hi, Found this code online and thought it might help people in this forum. Deals with the error "cannot find specified file" issue when trying to run a .exe file when there are spaces in the file path. Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run """C:\Program Files\WinRAR\WinRAR.exe""", 6, True
set wshshell = nothing Use 3 quotes. can't find the site where i got this from, otherwise would put in source. for the run method arguments visit - http://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.85).aspx
|
|
|
|
Hackoo
-
Total Posts
:
105
- Scores: 4
-
Reward points
:
0
- Joined: 6/25/2010
-
Status: offline
|
Re:Running an .exe file with spaces in file path...
Monday, June 27, 2011 6:05 AM
( permalink)
Take a look at this "How to Quote Like a Pro" and your source become like that: Function qq(strIn) qq = Chr(34) & strIn & Chr(34) End Function Set wshShell = WScript.CreateObject ("WSCript.shell") wshshell.run qq("C:\Program Files\WinRAR\WinRAR.exe"), 6, True set wshshell = nothing
|
|
|
|
skyline
-
Total Posts
:
77
- Scores: 3
-
Reward points
:
0
- Joined: 3/14/2011
-
Status: offline
|
Re:Running an .exe file with spaces in file path...
Monday, June 27, 2011 6:39 AM
( permalink)
thanks for sharing, but that was not my source. it was an external site, otherwise i would not have posted it on this site. Note the code i pasted has 3 quotes """path""" and the one you pasted has ("path").
|
|
|
|