Chocolatey, Programming

How to exclude an executable from getting shimming in a Chocolatey package

Hello ! I’m Xavier Jouvenot and in this small post, we are going to see how to exclude an executable from getting shimming in a Chocolatey package.

Self promotion: You can find other articles on my website 😉


When creating or interacting with Chocolatey packages, you may end up in a situation where the program installed via Chocolatey either does display nor finish its process. This can be very inconvenient, as the program does do what you ask it to do 😝

The problem comes from Chocolatey feature "EXECUTABLE SHIMMING", which doesn’t always is well set and then, do not wait for your program to finish running. It can usually happen when the program has a graphical interface, but you want to make it execute some process via the command line without any regard for the graphical interface.

We are going to detail 2 solutions : one if you are a user of the Chocolatey package, which is a workaround to the chocolatey package behavior, and another one if you are a Chocolatey package maintainer, to make your packages behave appropriately 😉



The solution, as a Chocolatey package user, is to pass a specific option to the command line you use:

my_program.exe --shimgen-waitforexit

The flag shimgen-waitforexit is exactly made for that kind of situation. But I also encourage you to notify the maintainers of the package so that they can implement the solution below, directly in the package itself.

Proper correction

If your package has this kind of error, there is a way to make correct it for good 🙂 By including the next line in you install script, you will be able to exclude the executables of your package from getting shims, which will correct the problem:

Get-ChildItem $PSScriptRoot\*.exe | ForEach-Object { New-Item "$_.ignore" -type file -force | Out-Null }

Let’s describe a little bit what is happening here !

First, we start by getting all the .exe files in the install folder of the Chocolatey Package. Then, for each executable found, we create a new empty file with the same name but which end up with the extension .exe.ignore. This extension will say to Chocolatey to now shims the executable, and correct our problem at the same time 😉

Thank you all for reading this article, And until my next article, have a splendid day 😉

Interesting links


1 réflexion au sujet de “How to exclude an executable from getting shimming in a Chocolatey package”

Votre commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l’aide de votre compte Déconnexion /  Changer )

Image Twitter

Vous commentez à l’aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l’aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s