How to escape spaces in a command?

eliteraspberries's Avatar

eliteraspberries

22 Aug, 2015 08:34 PM

I have these variables set:

environment:
  SDK_ROOT: "C:\\Program Files\\Microsoft SDKs\\Windows"
  SDK_VERSION: "v7.1"

and I'm trying to run these commands:

init:
  - "%SDK_ROOT%\\%SDK_VERSION%\\Setup\\WindowsSdkVer.exe -q -version:%SDK_VERSION%"
  - "%SDK_ROOT%\\%SDK_VERSION%\\Bin\\SetEnv.cmd /x64 /release"

The spaces in the SDK_ROOT variable are problematic. I've tried escaping with \, ^, ", double-slashes, double-quotes... no luck.

How could I escape the spaces in the path to run these two commands?

Thanks for your time.

  1. 1 Posted by eliteraspberrie... on 22 Aug, 2015 09:54 PM

    eliteraspberries's Avatar

    Using single quotes worked.

  2. 2 Posted by matt_mckinstry on 05 Mar, 2018 03:49 PM

    matt_mckinstry's Avatar

    Can you expand on where the single quotes were placed?

    Im having a nightmare trying to get secure-file to work when the file in question has a space in its name

    EAZFUSCATOR_LICENSE_NAME_1: 'License Copy'

    - tools\secure-file -decrypt 'tools\%EAZFUSCATOR_LICENSE_NAME_1%.txt.enc' -out '=tools\%EAZFUSCATOR_LICENSE_NAME_1%.txt' -secret %PASSWORD%

  3. Support Staff 3 Posted by Feodor Fitsner on 07 Mar, 2018 03:04 AM

    Feodor Fitsner's Avatar

    1) try removing quotes in environment variable definition:

    EAZFUSCATOR_LICENSE_NAME_1: License Copy
    

    2) Replace single quotes with double quotes in the command:

    - 'tools\secure-file -decrypt "tools\%EAZFUSCATOR_LICENSE_NAME_1%.txt.enc" -out "tools\%EAZFUSCATOR_LICENSE_NAME_1%.txt" -secret %PASSWORD%'
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

17 Jun, 2018 04:04 PM
16 Jun, 2018 08:06 PM
16 Jun, 2018 07:30 PM
16 Jun, 2018 09:22 AM
15 Jun, 2018 09:31 PM

 

15 Jun, 2018 08:31 PM
15 Jun, 2018 04:29 PM
15 Jun, 2018 12:39 PM
15 Jun, 2018 12:37 PM
15 Jun, 2018 08:21 AM
14 Jun, 2018 12:44 AM