Recently, I experienced all of the symptoms mentioned in the title (and more) after installing a new program on my computer. If you are having any some or all of the below issues, this post may be of some help.
- Receiving Run32dll.exe missing errors when attempting to launch certain admin programs (e.g. "Turn Windows features on or off," "Advanced system settings," etc.)
- Receiving missing DLL errors when attempting to run new (and occasionally old) programs
- Icons missing or not correctly loading in taskbar (e.g. Windows Explorer pin, etc; note that the Windows Explorer pin is usually one of the first to go and is usually not the only one)
- Right-clicking icons in taskbar gives warning or some kind of "not found" error, even icon is for an open program
- Visual Studio won't launch and throws a "target invocation exception"
This is the result of the PATH environment variable being too long. The PATH environment variable is limited to 2048 characters, and is truncated if that limit is exceeded.
- Before doing anything else, mouse over "Computer" and right-click -> "Properties", and click on "Advanced system settings" (on the left).
- If you receive an error, move on to Step 2; otherwise, go to Step 3.
- Restart your computer in Safe Mode (clickF8 while booting, before the Windows logo appears), and repeat Step 1
- Click on "Environment Variables" and double-click the "Path" variable in the bottom select box of the resulting Window
- Copy the contents of the "Variable value" field and paste it into a text editor, like Notepad
- Verify that the length of the PATH variable exceeds 2048 characters.
- If the length does not exceed 2048, then this is not your issue and you need not continue (though you may, if you so choose).
- Open up the Find and replace window (ctrl+hin most text editors), and find-replace the following:
- Find: "C:\Program Files\" Replace with: "C:\PROGRA~1\"
- DO NOT FORGET THE SLASHES - THEY WILL ENSURE THAT YOU DO NOT ACCIDENTALLY REPLACE INSTANCES OF "C:\Program Files (x86)\"
- Find: "C:\Program Files (x86)\" Replace with: "C:\PROGRA~2\"
- Verify that the PATH is now less than or equal to 2048 characters
- If its length is still greater than 2048, take a look at this post, which may provide more solutions to shorten the PATH; otherwise, continue to Step 8
- Copy the updated PATH and paste it back into the "Variable value" field for the PATH variable, and click "OK"
- Close all windows and Restart your computer (normal boot)
- Verify that all programs are now working and you can now open all admin windows (e.g. "Turn Windows features on or off," "Advanced system settings," etc.)
The above solution works, because the path "C:\PROGRA~1\" is actually equivalent to "C:\Program Files\" and "C:\PROGRA~2\" is equivalent to "C:\PROGRA~2".
If any task bar icons (pins) are still missing/broken...
If your symptoms included broken/missing icons in your taskbar, and they are not all fixed, do the following:
- Open up your command prompt
- Enter the following commands, one at a time (note that the last one will restart your computer)
taskkill /IM explorer.exe /F
CD /d %userprofile%\AppData\Local
DEL IconCache.db /a
shutdown /r /f /t 00
What this does is force Windows to rebuild your Icon Cache. If any of your pins are still missing/broken after rebuilding the icon cache, do the following:
- If the icon is broken, delete it from the task bar; otherwise, go to Step 2
- In the Start Menu or in Windows Explorer, find the program whose pin was missing/broken
- Open the program and right-click on the resulting icon in the task bar and click "Pin this program to taskbar"
- If the icon was pinned successfully, go to Step 8
- Otherwise, delete the broken pin and go to Step 4
- Find the program again in the Start Menu or in Windows Explorer (as you did in Step 2)
- Right-click the program and Send To -> Desktop (create shortcut)
- Click-and-drag the shortcut from the Desktop to the task bar
- Verify that the pin is now working as expected
- Repeat this process for all remaining broken pins