PowerShell, environment variables, command invocation, and spaces

Fil Maj's Avatar

Fil Maj

13 Jul, 2017 04:37 PM

I have tried so many different ways of invoking a command (the Android SDK manager) in my appveyor.yml. The location of the Android SDK that ships with the VS2017 image is under Program Files - with a damned space in it. And it is causing me to rip my hair out.

Full appveyor.yml code in its current form: https://github.com/filmaj/cordova-android/blob/ci-native-tests/appveyor.yml

You can see my frustrating via a series of latest commits in this pull request I am working on: https://github.com/apache/cordova-android/pull/392

I need to accept multiple Android licenses as part of using the SDK manager, so I use this line:

  - ps: for($i=0;$i -lt 30;$i++) { $response += "y`n"}; $response | cmd /c '"%UPDATE_SDK%"'

Basically trying to emulate typing "Y ENTER" 30 times.

The %UPDATE_SDK% environment variable looks like this, according to Appveyor output (I echo out the env var near the start of the appveyor.yml file):

C:\Program Files (x86)\Android\android-sdk\tools\bin\sdkmanager.bat --update

The error I'm getting is this:

for($i=0;$i -lt 30;$i++) { $response += "y`n"}; $response | cmd /c '"%UPDATE_SDK%"'
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Please help!

  1. Support Staff 1 Posted by Ilya Finkelshte... on 14 Jul, 2017 11:06 AM

    Ilya Finkelshteyn's Avatar

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


? 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


18 Aug, 2018 11:54 AM
18 Aug, 2018 12:13 AM
17 Aug, 2018 06:02 PM
17 Aug, 2018 04:26 PM
17 Aug, 2018 04:04 PM
17 Aug, 2018 06:31 AM