# Ansible script to install .exe file on windows with interactive mode

**URL:** <https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887>\
**Category:** Get Help\
**Tags:** windows\
**Created:** [April 11, 2024, 8:23am UTC](https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887 "2024-04-11T08:23:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debasis](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Debasis](https://forum.ansible.com/u/Debasis)\
**Post date:** [April 11, 2024, 8:23am UTC](https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887/1 "2024-04-11T08:23:54Z")

</div>

I am trying to install .exe file but win\_shell or win\_command is running the installer indefinightly. The exe installation requirs to feed instaructions during installation, like language : english, select a check box, next and finish etc. How can I achieve it with ansible script. Thanks a lot for your support.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [April 11, 2024, 9:52am UTC](https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887/2 "2024-04-11T09:52:12Z")

</div>

Try using [the expect module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html)?

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 11, 2024, 2:37pm UTC](https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887/3 "2024-04-11T14:37:49Z")

</div>

Not always, but many Windows installers can install non-interactively by providing all of the answers it needs at runtime. This might mean passing them all as arguements/parameters, or providing an answers file. Sometimes an exe is just a wrapper around an msi installer, which can be extracted and more easily installed since MSI is easy to automate.

There’s even a possibility that the install is already automated by Chocolatey, and you could leverage the [Chocolatey.Chocolatey](https://docs.ansible.com/ansible/latest/collections/chocolatey/chocolatey/index.html) collection.

Can you tell us what program you’re actually trying to install?

---

<div class="post-metadata">

**Author:** ![Debasis](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Debasis](https://forum.ansible.com/u/Debasis)\
**Post date:** [April 12, 2024, 7:42am UTC](https://forum.ansible.com/t/ansible-script-to-install-exe-file-on-windows-with-interactive-mode/4887/4 "2024-04-12T07:42:43Z")

</div>

Thank you all for your quick response.  
No, I have not tried with expect module nor with chocolatey package for this exe installation. Will try and update here.  
However I have made it work with creating a ‘ini’ file with all the interactive command and referring it from the ansible script.  
Command:

- name: install gpg4win-3.1.5.exe  
win\_command: D:\gpg4win-3.1.5.exe /S /C=D:\gpg4win.ini /D=D:\Gpg4win  
both the .exe file and ‘ini’ file inside ‘D:/’ drive.  
If anyone has any better solution, please share. Thank you.
