how does one escape this line

Folks

I would like to implement the following command via ansible’s win_command module:

%comspec% /k ““C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat”” amd64

I have tried everything I can think of, but the syntax checker always returns

“changed”: false,
“cmd”: “%%comspec%% /k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64”,
“failed”: true,
“invocation”: {
“module_name”: “win_command”
},
“msg”: “The system cannot find the file specified”,
“rc”: 2
}

or some variation thereof. For example, I’ve tried single quotes around single percents with double quotes inside:

win_command: ‘**%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64’

I’ve tried it with and without the double-backslashes. Pretty much every combination I can think of (except the right one!)

Anybody got an idea of how to escape this puppy so that the syntax checker doesn’t gak?

Thanks
Tony

got it:

  • win_command: ‘%comspec% /k “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat” amd64’

Never mind…the syntax-checker passes but ansible still can’t find the file…sigh…

That’s a tough one. There are lot of parsers to keep happy - python, yaml, jinja2 and powershell as well.

Just wondering if you could wrap the command line into another .bat or .ps1 file and then just run the wrapper and dodge a lot of the parsing perhaps?

Jon

yeah, I thought of that, but my powershell scripting experience is minimal, i was hoping to be able to “escape” my way to an answer. Will try the powershell approach.

Thanks Jon!
Tony