Add Batch file (*.bat) to New menu of File Explorer

In this article, we will see how to get a useful context menu item to create a New -> Batch file. It will save you time if you need to create them from time to time. You get a new file with the BAT extension instantly with one click.


Usually, to create a new batch file, you can either create a new text file and rename its extension every single time to .bat or .cmd, or you can use Notepad. Using Notepad, it is possible to save the entered text as a batch file by selecting the File - Save menu item and typing the filename with the bat extension in quotes. It is necessary to add quotes to save it with the correct extension.

Instead, the New -> Batch file menu item is more useful. To get it working, apply the following simple Registry tweak.

  1. Open Registry Editor.
  2. Go to the following Registry key:
    HKEY_CLASSES_ROOT\.bat

    Tip: You can access any desired Registry key with one click.

  3. Create a new subkey here named "ShellNew". You will get
    HKEY_CLASSES_ROOT\.bat\ShellNew

    Windows 10 shell new for bat file

  4. Under the ShellNew subkey, create a new string value named NullFile. Don't set its value data, leave it empty. This value indicates that Windows should create an empty file without any content. Windows 10 nullfile for bat file
  5. Again, under the ShellNew subkey, create a new string named ItemName. Set its value to the following string:
    @%SystemRoot%\System32\acppage.dll,-6002

    You will get the following: Windows 10 add new-windows batch file context menu

Now, open the context menu of any folder. You can just right click the empty space on your Desktop. It will have a new item in the "New" context menu: Windows 10 new-windows batch file context menu in action

Once you click it, a new empty *.bat file will be created: Windows 10 new-windows batch file created

The next time you need to create a batch file, you can use this context menu item to save your time. You can use the same trick to create a .cmd file.

The same can be done using Winaero Tweaker. Go to Context Menu -> "New" Menu in File Explorer:
Winaero Tweaker new context menu Use this option to avoid Registry editing.

Also, I made ready-to-use Registry files, so you can avoid manual Registry editing. An undo file is also included.

Download Registry files

That's it. This tricks works in Windows 7, Windows 8 and Windows 10. It should work in older Windows versions too.

10 thoughts on “Add Batch file (*.bat) to New menu of File Explorer

  1. David H Johnson

    This is great! Thank you so much!

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      You are welcome.

      Like or Dislike: Thumb up 1 Thumb down 0

      Reply
  2. Thark

    Hmm.. cool!
    A nice way to crate a file would one without any ending-extension.. is this possible too? ^^

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      Let me see. I guess it is not possible.

      Like or Dislike: Thumb up 1 Thumb down 0

      Reply
      1. David H Johnson

        Save this as a .reg file, and it will create a file called New Generic File with no extension.

        Windows Registry Editor Version 5.00

        [HKEY_CLASSES_ROOT\.generic]
        @=”genericfile”

        [HKEY_CLASSES_ROOT\.generic\ShellNew]
        “NullFile”=””
        “IconPath”=”%SystemRoot%\\System32\\imageres.dll,2”

        [HKEY_CLASSES_ROOT\.generic\ShellNew\Config]
        “NoExtension”=””

        [HKEY_CLASSES_ROOT\genericfile]
        @=”Generic file”

        Well-loved. Like or Dislike: Thumb up 4 Thumb down 0

        Reply
        1. Sergey Tkachenko Post author

          Great! Thank you.

          Like or Dislike: Thumb up 3 Thumb down 0

          Reply
  3. Tony

    Does the zip contain the .cmd?I can’t access it because(in time when i wrote this comment) I’m on the phone.

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      It contains two *.reg files.

      Like or Dislike: Thumb up 1 Thumb down 0

      Reply
      1. David H Johnson

        I believe this is what he wants. Save as reg file or open regedit, and add manually this:

        Windows Registry Editor Version 5.00

        [HKEY_CLASSES_ROOT\.cmd]
        @=”cmdfile”

        [HKEY_CLASSES_ROOT\.cmd\ShellNew]
        “NullFile”=””

        You will then have a right-click item which will add “New Windows Command Script.cmd” on your desktop.

        Like or Dislike: Thumb up 2 Thumb down 0

        Reply
        1. Tony

          The problem was solved at 16:55 (GMT+1) by the command script. I’ve just edited the “@%SystemRoot%\System32\acppage.dll,-6002” into “@%SystemRoot%\System32\acppage.dll,-6003” or so. And also, in the script is included the uninstaller, which removes entire key. By the way, thanks for help :)

          Like or Dislike: Thumb up 1 Thumb down 0

          Reply

Leave a Reply

Your email address will not be published. Required fields are marked *