How to create a new text document (TXT) file by a Hotkey?

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

5

7 Answers

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.
F4::
Macro1:
Click, Right, 1
Sleep, 10
SendRaw, wt
Return

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.

5

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.

1

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.

2

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 return
#IfWinActive

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 ;#z:: ;#IfWinActive ahk_class WordPadClass ;#z:: ;MsgBox You pressed Win+Z in either Notepad or WordPad. ;return

Hope you find this useful!

2

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
exit
1

You Might Also Like