There is no script engine for file extension ".vbs" or ".vbx": How I solved it !
Earlier this week, I experienced the error message “There is no script engine for file extension “.vbs”“ on computers running both Windows 10 and Windows 11. In this article I will talk about what I tried unsuccessfully and then successfully to fix it.
You will most likely experience this error message when launching a program or installer that tries to run a .vbs script. For me it was shown just a few seconds after launching the PostgreSQL 14 installer and was blocking me from completing the installation.
What are VBS files?
The error message will either describe a problem with VBS or VBX files. These files are Visual Basic scripts that should normally be run by the Windows Script Host (wscript.exe).
Root cause
There seems to be a few different root causes for this problem. Either a program like Notepad++ has become associated with these files instead of wscript.exe, or alternatively the problem might be caused by a Windows Group Policy (GPO).
Luckily, it’s quite easy to fix the issue, no matter the root cause.
The fix that didn’t work for me
Several posts on Stack Overflow talk about running Notepad++ as an administrator, opening the Settings > Preferences > File Associations menu and removing the association to VBS files.
This did not fix my issues, since Notepad++ wasn’t associated with VBS files to begin with.
The fix that worked for me
And finally, this is how I managed to resolve the issue. Note: for some reason I had to run through these steps twice on Windows 10 but not Windows 11.
1) Open Command prompt as an administrator and then run the below commands. These will force Windows to re-associate the Visual Basic files with Windows Script Host.
assoc .vbs vbs=VBSFile
assoc .vbx vbs=VBSFile
2) Re-register the DLL file used to run these scripts. Type the following into the open admin command prompt window.
regsvr32 %systemroot%\system32\vbscript.dll
3) Enter the following into the open admin command prompt window.
cscript.exe //H:WScript
And that’s it. After these steps I was able to complete the PostgreSQL installation.