I’m trying to run an exe with a space in the filename using the Win Command module.
For example ‘filenames with spaces.exe’
I have other playbooks that use win command to run exe files, but those files don’t have spaces in the filename, but this isn’t an option for this particular scenario unfortunately.
I’ve tried a bunch of things (single quotes, double quotes, single and double quotes, double double quotes, etc.) but I just keep getting an error.
Wondering if anyone else has run into this problem and if so, how it was resolved.
If the path to the executable has a space you need to quote it, unfortunately yaml makes that a bit more difficult as whatever quote you start the value on you also need to end with that quote. There are 2 solutions I recommend to you:
Wrap the whole value in a single quote and use an inner double quote
The first solution is ok for small command lines but the line length gets quite long and hard to read. The latter is quite useful as any newline in the value is just concatenated together with a space. For example the following is the exact same as the 2nd example