In a playbook, assuming you are using ansible 2.x then you should be able to leave out the single quotes for a hard coded path like this
raw: powershell.exe -NoLogo -file C:\Program Files\App\install-service.ps1 If you need to use a variable then use double quotes and double backslashes raw "powershell.exe -NoLog -file C:\\Program Files\\App\\install-service.ps1" Be aware there's a bug right now if you are passing in windows paths as -e or with key=value to the ansible command so \a looks like a unicode escape sequence. You can usually work around it by using an upper case path \A By the way, the raw module is running powershell, so you might not need to start with powershell.exe Also, if you are installing a windows service (or wrapping up an executable so that it can be controlled as a windows service), you might be able to use the win_nssm module (if you don't mind installing nssm). On Tuesday, May 24, 2016 at 3:58:34 PM UTC+1, Mike Fennemore wrote: > > raw: 'powershell.exe -Nologo -file C:\Program Files\App\install-service.ps1' > > "module_name": "raw"}, "rc": 1, "stderr": "Processing -File 'C:\\Program' > failed because the file does not have a '.ps1' extension. Specify a valid > Windows PowerShell script file name, and then try again.\r\n", "stdout": "", > "stdout_lines": []} > > How does one escape the \ and the whitespace in a path used in the raw > module? > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d983d8b6-7a86-445e-b0ab-a1ebd530c6b4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
