VBScript Files Open With Notepad

When you try to run a Vbscript by double-clicking it, the script may open in Notepad. This happens if Notepad (instead of wscript.exe) is set as the default application for .vbs files.

vbs files open in notepad

Running Vbscripts manually

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:

cscript.exe "drive:\path\filename.vbs"

To run a VBScript file using WScript.exe, use the following command:

wscript.exe "drive:\path\filename.vbs"

Fix the Default “Open” 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:

Download vbsfix.zip and save to Desktop. Unzip and run the enclosed REG file vbsfix_vista.reg by double-clicking it. Click Yes when asked for confirmation.

This changes the default action for .vbs files associating them with wscript.exe.

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

4 thoughts on “VBScript Files Open With Notepad

  1. Thanks a lot!
    It took me some time to find this site and your answer to a problem that has bugged me for over a week. But your solution worked!
    Thanks again,
    Gunnar

Comments are closed.

+1
Share
Tweet
Share
Pin