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/checks#step:3:1

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
2 Likes

Try

call “<path>”

single backslashes

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

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

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"
1 Like

On Github Actions, using shell: pwsh (PowerShell 6) and running the scripts like the following works both on Windows and Linux (using ' around the command and escaping " using \:

run: julia -e 'using Pkg; Pkg.add(PackageSpec(url = \"https://github.com/aminya/SnoopCompile.jl\", rev = \"multios\"));'

shell: pwsh

So the only difference with bash is the need for explicit escaping of " using \

run: julia -e 'using Pkg; Pkg.add(PackageSpec(url = "https://github.com/aminya/SnoopCompile.jl", rev = "multios"));'

shell: bash