Running an .exe file with spaces in file path...

Author Message
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)
0
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
 
 
#1
    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)
    0
    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
     
     
     
     
    #2
      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)
      0
      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").
       
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9