Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 5

Windows: syntax for Run path with spaces

What is the syntax to use in the yaml file to execute a batch file with spaces in the path? I've tried single and double quotes and doubling up the backslashes, but still haven't landed a working combination.

 

Example from https://github.com/maphew/svg-explorer-extension/commit/718fc24090264ed22bd244b20868b7ca25cd06c4/che...

 

Run C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\tools\\vcvars64.bat

C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\tools\\vcvars64.bat

shell: C:\windows\system32\cmd.exe /D /E:ON /V:OFF /S /C "CALL "{0}""

'C:\\Program' is not recognized as an internal or external command,

 

yaml excerpt:

    steps:
    - uses: actions/checkout@v1
    - name: init vs studio
      run: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\tools\\vcvars64.bat'
    - name: configure
      run: configure
4 Replies
Pilot Lvl 1
Message 2 of 5

Re: Windows: syntax for Run path with spaces

Try

call "<path>"

 

single backslashes

Copilot Lvl 3
Message 3 of 5

Re: Windows: syntax for Run path with spaces

Thanks for the suggestion, but no go.

  • Call with single backslashes yields "yaml: line 13: found unknown escape character" 
  • Call with double backslash is "Your workflow file was invalid: .github/workflows/ccpp.yml (Line: 13, Col: 7): Unexpected value 'call'"
  • and finally run: call "C:\\Program Files (x86)\...{snip}...\\vcvars64.bat" yields:
    shell: C:\windows\system32\cmd.exe /D /E:ON /V:OFF /S /C "CALL "{0}""
    '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\tools\\vcvars64.bat"' is not recognized as an internal or external command, operable program or batch file.

    see https://github.com/maphew/svg-explorer-extension/runs/215876454#step:3:1

Pilot Lvl 1
Message 4 of 5

Re: Windows: syntax for Run path with spaces

Sorry, didn't actually try it, but I've had times where

run: <statement>

didn't work, but

run: |

  <statement>

did...

 

The example I knew existed was:

 

  run: |
    call "C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
win32/configure.bat --disable-install-doc --without-ext=+,dbm,gdbm --enable-bundled-libffi --with-opt-dir=C:/vcpkg/installed/x64-windows

 

See: Ruby CI windows.yml

Copilot Lvl 3
Message 5 of 5

Re: Windows: syntax for Run path with spaces

making progress. Key things:

 

"run: |" creates a script.

run: |
    echo 'foo'
    echo 'bar

 .cmd file:

 

echo 'foo'
echo 'bar'

 

 

Foreward slashes work (but not always):

pushd "C:/Program Files (x86)/Microsoft Visual Studio"
:: Uncomment next line to find all bats in this tree
rem dir /s/b *.bat
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"