Q: When I attempt to launch a VBScript by double-clicking it, it opens in a Notepad. Apparently Notepad has set itself up as the default application for handling .VBS files. I cannot find the correct executable to execute this script.
This happens if the default handler for .VBS files is changed. This may have been done by some security suite so that users don’t accidentally run .VBS files by double-clicking on them. To run the script, you may use one of these two Windows Script Host executables.
- CScript.exe (Console-based Scripting Host)
- WScript.exe (Windows-based Scripting Host)
Whether you use WScript or CScript, you still run the scripts in the same manner. The difference is only in the output — WScript generates windowed output, while CScript sends its output to the command window in which it was started. (REF: Running Scripts from Windows)
To run a VBScript file using CScript.exe, use the following command:
To run a VBScript file using WScript.exe, use the following command:
Reset the Default Action for VBScripts
To reset the default action for .VBS file types so that double-clicking executes the file instead of opening it in Notepad, use these steps:
1. Download vbsfix.zip and save to Desktop.
2. Unzip the archive, and store the files in a folder.
3. If you’re using Windows XP, double-click vbsfix_xp.reg to run it.
4. If you’re using Windows Vista, double-click vbsfix_vista.reg to run it.
5. Click Yes when asked for confirmation.