0 Favourites

How do I wrap a path with spaces in double quotes? [solved]

  • In the NWjs plugin, the action "File System > Run file" says:

    [quote:30m53pe5]To execute a path with spaces in it, wrap in double-quotes (e.g. """C:\Program Files\file.exe""").

    How can this be done?

    I've tried using many combinations of quote marks, as variables or directly using (&" ' ' ' ' ") in multiple combinations.

    Any concrete examples?

    Thx

  • Run

    """C:\Program Files\Microsoft Games\Solitaire\Solitaire.exe"""[/code:cxcxiq4h]
    works for me..
    
    ...also in variable 
    [img="http://lookpic.com/O/i2/1376/1uCjUbNV.png"]
  • Thanks korbaach,

    I forgot to mention that I'm looking to apply this method to open a folder, not run an executable.

    Using the variable method and a text box in the app as the input, I can run an executable with quotes:

    "c:\Program Files\program.exe"

    Using the same input box, I've added the word "start" in front of the folder I want to open. But this only works with folder paths without spaces, like "c:\". Once I add spaces, I haven't yet found a way to make it work.

  • I've found something from this link

    http://stackoverflow.com/questions/1880 ... in-windows

    [quote:1pdydrxm]A workaround I use is to use the "short names" for the directories in the path, instead of their standard, human-readable versions. So e.g. for C:\Program Files\ I would use C:\PROGRA~1\ You can find the short name equivalents using dir /x.

    The basics is the first six characters in uppercase, followed by a tilde, then a number to differentiate multiple folders with the same first six characters.

    "C:\PROGRA" + "~" + "1"

    This numeric approach will eventually break if you have multiple folders with the same first six characters. But windows uses this short-form convention on all folders and starts getting creative with it. You'll have to find exactly which short form windows has assigned the folder you want. To find it, press and hold the windows key, then press "R", which will bring up the "Run" window. Type "cmd" to bring up a dos command window from the 1890's (or 80's?).

    Navigate to the folder that has within it the folders you want to see the short forms for. Then type "dir /x". A table of the folders in the current directory will appear along with their short forms.

    Then replace the folder path component with spaces in it with this short form.

    Then you can set a variable in c2 to "start c:\PROGRA~1\SUBFOL~1\..." without any quotes. Once this runs, windows will then recognize the short forms and open you folder.

    Easy, right? <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • [quote:3ofj49d5] I've added the word "start" in front of the folder I want to open

    or you can just replace word "start" with "explorer "

    "explorer ""C:\Program Files"""[/code:3ofj49d5]
    [code:3ofj49d5]"explorer ""C:\Program Files\Microsoft SQL Server"""[/code:3ofj49d5]
    
    [img="http://lookpic.com/O/i2/1048/ZbF6FsFl.png"]
  • [quote:2ulody99] I've added the word "start" in front of the folder I want to open

    or you can just replace word "start" with "explorer "

    "explorer ""C:\Program Files"""[/code:2ulody99]
    [code:2ulody99]"explorer ""C:\Program Files\Microsoft SQL Server"""[/code:2ulody99]
    
    [img="http://lookpic.com/O/i2/1048/ZbF6FsFl.png"]
    
    
    Yes, or that.
  • [quote:4ali2fru] I've added the word "start" in front of the folder I want to open

    or you can just replace word "start" with "explorer "

    "explorer ""C:\Program Files"""[/code:4ali2fru]
    [code:4ali2fru]"explorer ""C:\Program Files\Microsoft SQL Server"""[/code:4ali2fru]
    
    [img="http://lookpic.com/O/i2/1048/ZbF6FsFl.png"]
    
    
    In the desktop program I've created, I put in a "paste" button that copies the clipboard content and sends it to a text object for the user to see.  It then also checks if the folder exists, and if it does, it displays a list of its subfolders.
    
    I've run into the problem of special characters in the file path.  When there are periods in the filepath, checking for the existence of the filepath causes an error.  When there is an ampersands (&) in the filepath, checking for the folder works, but using the "open folder" command opens an explorer window, but not the filepath obtained from the clipboard.
    
    Pasting the file path directly into an explorer window always seems to work if the folder exists.  Any ideas on how to handle special characters in the filepath in the nwjs plugin to prevent errors?
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,149
karshinkoff's avatar
karshinkoff
Unread hot topic
0 Favourites
Path Movement Behavior
98 52,480
R0J0hound's avatar
R0J0hound
Unread hot topic
0 Favourites
Space Zombies by RED BABOON
77 9,768
imothep85's avatar
imothep85