Thanks!

I ended up just quoting those names in the shell ==> win_command: '"file 
name with spaces.exe"'

On Sunday, August 22, 2021 at 2:19:08 PM UTC-5 [email protected] wrote:

> 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
>
> - win_command: '"C:\Program Files\Program\some.exe" arg1 arg2 "argument 3"'
>
> * Use >- as a multiline yaml string
>
> - win_command: >-
>     "C:\Program FIles\Program\some.exe" arg1 arg2 "argument 3"
>
> 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
>
> - win_command: >-
>     "C:\Program FIles\Program\some.exe"
>     arg1
>     arg2
>     "argument 3"
>
> On Saturday, August 21, 2021 at 2:13:06 AM UTC+10 [email protected] 
> wrote:
>
>> Hi,
>> You can try escaping or store the file names in register and pass 
>> register through loop to run your executable files.
>>
>> //Vinoth 
>>
>> On Fri 20. Aug 2021 at 17:30, [email protected] <[email protected]> wrote:
>>
>>> 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.
>>>
>>> Thanks in advance!
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/0783e170-1f85-468b-8cb7-a932f9851ffdn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/0783e170-1f85-468b-8cb7-a932f9851ffdn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/27936c8b-be36-4bde-acf6-179921233756n%40googlegroups.com.

Reply via email to