# Run .exe on windows command prompt

**URL:** <https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 28, 2015, 8:27am UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367 "2015-09-28T08:27:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jugal\_Porwal](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Jugal\_Porwal](https://forum.ansible.com/u/Jugal_Porwal)\
**Post date:** [September 28, 2015, 8:27am UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/1 "2015-09-28T08:27:05Z")

</div>

Hi,

I want to run a .exe on windows command prompt from my centos control node. The command is as follows :

wrapper.exe -t wrapper.conf

Initially i tried to atleast run the .exe without any args using my following playbook :

```auto
---
- hosts: windows
  tasks:
    - name: Register as a service
      raw: 'D:\builds\router\bin\wrapper.exe'

```

But i got the following error:

fatal: [192.168.199.94]: FAILED! =\> {“changed”: false, “failed”: true, “rc”: 1, “stderr”: “#\< CLIXML\r\n\<Objs Version="1.1.0.1" xmlns="[[http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C)]([http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C))”\>\<S S="Error"\>D:_x0008\_uilds : The term 'D:x0008\_uilds’ is not recognized as the name of a cmdlet, x000D\_\_x000A\<S S="Error"\>function, script file, or operable program. Check the spelling of the name, or x000D\_\_x000A\<S S="Error"\>if a path was included, verify that the path is correct and try again.x000D\_\_x000A\<S S="Error"\>At line:1 char:1\_x000D\_\_x000A\<S S="Error"\>+ D:x0008\_uilds\_x000D\_\_x000A\<S S="Error"\>+ ~~~~~~~~x000D\_\_x000A\<S S="Error"\> + CategoryInfo : ObjectNotFound: (D:x0008\_uilds:String) [], CommandNot x000D\_\_x000A\<S S="Error"\> FoundException\_x000D\_\_x000A\<S S="Error"\> + FullyQualifiedErrorId : CommandNotFoundException\_x000D\_\_x000A_\<S S="Error"\> _x000D\_\_x000A_\<S S="Error"\>outer\_x0008\_in\wrapper.exe : The module ‘outer\_x0008\_in’ could not be loaded. For more _x000D\_\_x000A_\<S S="Error"\>information, run ‘Import-Module outer\_x0008\_in’._x000D\_\_x000A_\<S S="Error"\>At line:2 char:1\_x000D\_\_x000A\_\<S S="Error"\>+ outer\_x0008\_in\wrapper.exe\_x000D\_\_x000A\_\<S S="Error"\>+~~~~~~~~~~~~~~~~~~~~_x000D\_\_x000A_\<S S="Error"\> + CategoryInfo : ObjectNotFound: (outer\_x0008\_in\wrapper.exe:String) _x000D\_\_x000A_\<S S="Error"\> , CommandNotFoundException\_x000D\_\_x000A\_\<S S="Error"\> + FullyQualifiedErrorId : CouldNotAutoLoadModule\_x000D\_\_x000A\_\<S S="Error"\> _x000D\_\_x000A_", “stdout”: “”, “stdout\_lines”: }

Is it achievable what i’m trying to do?

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [September 28, 2015, 6:47pm UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/2 "2015-09-28T18:47:14Z")

</div>

It appears as though the backslashes are escaping the character that  
follows (which doesn't quite make sense since your example uses a  
single-quoted string). What version of ansible are you using?

You could try: raw: "D:\\builds\\router\\bin\\wrapper.exe"

---

<div class="post-metadata">

**Author:** ![dyioulos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dyioulos/32/8363_2.png) [@dyioulos](https://forum.ansible.com/u/dyioulos)\
**Post date:** [September 28, 2015, 7:57pm UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/3 "2015-09-28T19:57:34Z")

</div>

Try the raw command without any quotes, as in raw: D:\builds\router\bin\wrapper.exe. The following worked for me, and installed vlc on a test win2k8 box:

---

<div class="post-metadata">

**Author:** ![Balaji\_Chandrababu](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Balaji\_Chandrababu](https://forum.ansible.com/u/Balaji_Chandrababu)\
**Post date:** [January 19, 2016, 10:24am UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/4 "2016-01-19T10:24:36Z")

</div>

Hi Dimitri,

I’m trying to do pretty much the same with our own installer.

This is what i have got in the playbook.

Example:

- name: Install ZoneSense and Niva latest version  
raw: ‘C:\Temp\ZoneSense 16.0.0.343.exe /S’

I tried other options as well: raw: ‘“C:\Temp\ZoneSense 16.0.0.343.exe” /S’ and raw: “C:\Temp\ZoneSense 16.0.0.343.exe /S”

But none of them seems to work. It fails with the following error:

fatal: [uk-lon01-cs08.mirriad.corp]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_args”: {“_raw\_params": “"C:\\Temp\\ZoneSense 16.0.0.343.exe" /S”}, “module\_name”: “raw”}, “rc”: 1, “stderr”: “#\< CLIXML\r\n\<Objs Version="1.1.0.1" xmlns="[http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C)”\>\<S S="Error"\>At line:1 char:39\_x000D\_\_x000A_\<S S="Error"\>+ "C:\\Temp\\ZoneSense 16.0.0.343.exe" /S\_x000D\_\_x000A\_\<S S="Error"\>+ ~_x000D\_\_x000A_\<S S="Error"\>You must provide a value expression following the ‘/’ operator._x000D\_\_x000A_\<S S="Error"\>At line:1 char:39\_x000D\_\_x000A\_\<S S="Error"\>+ "C:\\Temp\\ZoneSense 16.0.0.343.exe" /S\_x000D\_\_x000A\_\<S S="Error"\>+ ~_x000D\_\_x000A_\<S S="Error"\>Unexpected token ‘S’ in expression or statement._x000D\_\_x000A_\<S S="Error"\> + CategoryInfo : ParserError: (🙂 , ParentContainsErrorRecordException\_x000D\_\_x000A\_\<S S="Error"\> + FullyQualifiedErrorId : ExpectedValueExpression\_x000D\_\_x000A\_\<S S="Error"\> _x000D\_\_x000A_”, “stdout”: “”, “stdout\_lines”: }

Please let me know how to workaround this.

Thanks,  
Balaji

---

<div class="post-metadata">

**Author:** ![Mick\_st\_john](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mick\_st\_john](https://forum.ansible.com/u/Mick_st_john)\
**Post date:** [April 8, 2016, 2:21pm UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/5 "2016-04-08T14:21:31Z")

</div>

Did you find any solution for this? If you’ve please help, I’m facing the same issue.

---

<div class="post-metadata">

**Author:** ![dyioulos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dyioulos/32/8363_2.png) [@dyioulos](https://forum.ansible.com/u/dyioulos)\
**Post date:** [April 8, 2016, 7:32pm UTC](https://forum.ansible.com/t/run-exe-on-windows-command-prompt/19367/6 "2016-04-08T19:32:12Z")

</div>

Once again, I’d suggest trying the raw command without quotes:

raw: c:\temp\vlc-2.2.1-win32.exe /S
