OS: Windows (Windows Explorer).

I'm frequently using: RightClick → New → Text Document

It lets you to name the file before opening and saving it. Is there a solution to run a script by a Hotkey and get it? (No matter what the Keyboard Layout is)

Maybe this can help "Create new text document" option missing from context menu

  • Half of the answer might include: pin Notepad to the start menu via right click -- pin to start menu. After that, click on the new Notepad entry on top of the start menu and choose Properties. In the Shortcuttab, hit the mouse cursor into the Shortcut Key box and press your chosen hot key, e.g. ctrl-alt-n. Close the properties windows with "OK". After that, Notepad will be started after you press ctrl-alt-n. However, if you hit File - Save as... in Notepad, it will open your Documents library, so you have to browse to the final destination first. – stueja Jun 20 '16 at 11:17
  • Thank you for your answer, but the question is about, how to name the txt file before you open it for editing - a Hotkey for this. – Stamimail Jun 23 '16 at 8:04
  • You should clearly state what OS (OS family) and file manager you are talking about. I can guess it's Windows and its native explorer.exe and I'm probably right; nevertheless your question should provide that information. A tag will be useful. – Kamil Maciorowski Jul 3 '16 at 17:33
  • Another hint: fsutil file createnew emptyfile.txt 0 – Stamimail Jun 22 '18 at 8:38

You can actually use your keyboard to naviagte the right-click menu.

Just right click and press W then T.

If you want to customise a keyboard shortcut, you could use something like AutoHotKey. An example script to do what you want would be like this.

Click, Right, 1
Sleep, 10
SendRaw, wt

You can use this script by copying it to a text file and saving it as .ahk. With AutoHotKey installed, just double-click to activate.

Quick note:

The first line tells it to run the actions when the F4 is pressed. You can change the key by editing the first line.
The modifier keys are as follows:

# Win (Windows logo key)
! Alt
^ Control
+ Shift
& An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey.

Where ^C means Control + C
Anything more advanced can be found in the docs. I suggest checking out the tutorial page.

  • Assuming Windows and Windows Explorer. – ak11234 Jul 4 '16 at 21:56
  • 1
    This solution is a kind of workaround. I was looking for a more direct solution, but thanks. – Stamimail Jul 7 '16 at 13:10
  • instead of doing a mouse click, it's better to press the menu key on the keyboard which is called AppsKey in AHK – phuclv Sep 12 '18 at 5:04
  • 2
    The menu key should be used. The OP was asking for a "hotkey" not a mouse click. – Avatar Jan 7 '19 at 5:55
  • 2
    Well, yesterday I was about to create a New Folder using ctrl + shift + n. Then I accidentally pressed some wrong button (I don't know which one) and thus created a New Text Document.txt file. Later, I tried to recreate the event but couldn't find the right key combination. Maybe there is a shortcut. – Meraj al Maksud Jul 26 '19 at 6:36

This isn't a hotkey as such but can be accomplished entirely on the keyboard and doesn't require any programs or system changes:

ALT+h, w and then press or as many times as necessary.


Another shortcut on Windows10 will be: alt+h, w - than right-click on "New Dokument" and from the dropdown menu choose "Add gallery to QuickAccess Toolbar". Now the whole dropdown menu is accessible on every WindowsExplorer Window at the very, very top left of the window. Now whenever you need to open a WinExplorer window, you can add a Text File (or other stuff) with just 2 klicks. For Win10 (not tested on older Operating Systems) Hope this helps somebody.

  • Alt+H, W was answered by pyrmont days ago – phuclv Sep 23 '18 at 14:02
  • @phuclv I don't think @NikosNachos is repeating the Alt+H, W answer. The details of the answer are to add the function to the Quick Access Toolbar putting the desired functionality within 2 keystrokes (eg Alt, 3) rather than 8 (eg Alt, h, w, dwn, dwn, dwn, dwn, dwn). – Josh Gust Jan 28 '19 at 22:48

I use QTTabBar.Open QTTabBar options. Keyboard Shortcuts. Scroll down to Create a new txt file. It has assigned Ctrl + Shft + T already. Highlight and change it to F8 or any other. Done. In explorer press F8 and it creates "New Text Document"


You can also do this:

Shift + F10(it will open context menu)

And then press w then t


This is the autohotkey script I'm using,

  • Works on file dialogs (save as / open file)
  • Works even though a file is selected
  • Works even though cursor is positioned off screen


;   New text file

#IfWinActive AHK_CLASS #32770
    Capslock & f11::
#IfWinActive AHK_CLASS CabinetWClass
    Capslock & f11::

    ; make it work even though a file is previously selected
    Send {PgUp} ; Force select the first file 
    Send ^{Space} ; Clear the selection

    Sleep 250 ; Remove delay if not required
    Send {AppsKey} ; Menu key
    Send w ; New
    Send t ; Text Document

Change "Capslock & f11" to your preferred shortcut.

To understand the syntax above, see below example,

;   Syntax - To have the same hotkey subroutine executed by more than one variant, the easiest way is to create a stack of identical hotkeys, each with a different #IfWin directive above it. For example:
    ;#IfWinActive ahk_class Notepad
    ;#IfWinActive ahk_class WordPadClass
    ;MsgBox You pressed Win+Z in either Notepad or WordPad.

Hope you find this useful!


1- Create a batch file (.bat) that opens notepad

2- Create a shortcut of the batch file and add keyboard shortcut for it

Batch file contents:

@echo off
start notepad.exe

Not the answer you're looking for? Browse other questions tagged or ask your own question.