Skip navigation

JSI Tip 2605. How can I prevent certain types of applications from running automatically?

If you want to prevent certain applications, such as a Visual Basic Script in an e-mail attachment, from running automatically, you can change the default application handler for that specific extension. Some candidate extensions are:


To cause these extensions to open in Notepad instead of their current default:

1. Open a CMD prompt and type:

    assoc .extension

    Example: assoc .vbs

2. This will display a line in the following format:


    Example: .vbs=VBSFile

3. Type:

    ftype FileTypeHandler

    Example: ftype VBSFile

4. This will display a line in the following format:

    FileTypeHandler=<path>\Program.exe "%1"

    Example: vbsfile=%SystemRoot%\System32\WScript.exe "%1" %*

5. Change the executable to Notepad by typing:

    ftype FileTypeHandler=%SystemRoot%\System32\Notepad.exe "%1"

    Example: ftype VBSFile=%SystemRoot%\System32\Notepad.exe "%1" %*

NOTE: You may wish to export the registry entries involved, before making these changes, so that they can easily to restored. To do so:

    regedit /e <Path>\FileTypeHandler.reg "HKEY_CLASSES_ROOT\FileTypeHandler\Shell\Open\command"

    Example: regedit /e c:\VBSFile.reg "HKEY_CLASSES_ROOT\VBSFile\Shell\Open\command"

NOTE: Repeat these steps for each extension that you wish to prevent from running automatically.

NOTE: Once you know the FileTypeHandlers involved, you can do this in a batch:

regedit /e c:\VBSFile.reg "HKEY_CLASSES_ROOT\VBSFile\Shell\Open\command"
ftype VBSFile=%SystemRoot%\System32\Notepad.exe "%1" %*

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.