VBScript Files Open With Notepad


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:

CScript.exe "path:\filename.vbs"

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

WScript.exe "path:\filename.vbs"

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.


Email SubscriptionPrefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

4 Comments

  1. Eduardo
    said this on Wednesday, April 23rd 2014 6:19 am

    in windows 7 it works for me, thanks

    I execute the reg file for windows vista ( vbsfix_vista.reg)

  2. Ron
    said this on Tuesday, October 26th 2010 8:14 pm

    This does not work for windows 7, any solutions for windows 7

  3. GunnarS
    said this on Sunday, August 22nd 2010 8:26 pm

    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

  4. easy
    said this on Saturday, July 31st 2010 5:44 pm

    great info, it helps me alot.

Leave a Reply