# Running exe on windows from a batch file

**URL:** <https://forum.ansible.com/t/running-exe-on-windows-from-a-batch-file/25978>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 9, 2017, 8:15pm UTC](https://forum.ansible.com/t/running-exe-on-windows-from-a-batch-file/25978 "2017-11-09T20:15:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [November 9, 2017, 8:15pm UTC](https://forum.ansible.com/t/running-exe-on-windows-from-a-batch-file/25978/1 "2017-11-09T20:15:46Z")

</div>

I don’t think win\_shell is necessary, you are truly trying to run an executable and don’t want to confuse issues that may be related to how the shell handles things and how a command handles it. In your case you will need to enclose the full command with a single quote ', you tried this but I think forgot to close the string with a ’ hence Ansible telling you that there was inbalanced quotes. I just tried the following on a brand new server and it was successful in install Cygwin.

- hosts: ‘2012R2’  
gather\_facts: no  
tasks:

- name: download Cygwin installer  
win\_get\_url:  
url: [https://cygwin.com/setup-x86\_64.exe](https://cygwin.com/setup-x86_64.exe)  
dest: C:\temp\setup-x86\_64.exe

- name: install Cygwin  
win\_command: ‘C:\temp\setup-x86\_64.exe --root C:\cygwin64 --quiet-mode --site [http://cygwin.mirror.constant.com](http://cygwin.mirror.constant.com) --packages “openssh,rsync,zip,vim,wget,nano”’

As you can see, the whole string for win\_command is enclosed with ’ and it has allowed me to continue to use " and \ without escaping anything. Here you can see Cygwin is installed and up and running

[![](https://lh3.googleusercontent.com/-k2_L64sggLI/WgS3VyqlLKI/AAAAAAAAARs/yxWDMQ_-gcoFq3WzyvLGOm-Cjbt7LGTtgCLcBGAs/s400/Screen%2BShot%2B2017-11-10%2Bat%2B6.13.55%2Bam.png)](https://lh3.googleusercontent.com/-k2_L64sggLI/WgS3VyqlLKI/AAAAAAAAARs/yxWDMQ_-gcoFq3WzyvLGOm-Cjbt7LGTtgCLcBGAs/s1600/Screen%2BShot%2B2017-11-10%2Bat%2B6.13.55%2Bam.png)

Thanks

Jordan
