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

19

4

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

Stamimail

Posted 2016-06-20T08:15:00.493

Reputation: 236

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 – 2016-06-20T11:17:02.330

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 – 2016-06-23T08:04:12.923

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 – 2016-07-03T17:33:24.570

Another hint: fsutil file createnew emptyfile.txt 0 – Stamimail – 2018-06-22T08:38:41.890

Answers

17

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.

ak11234

Posted 2016-06-20T08:15:00.493

Reputation: 365

Assuming Windows and Windows Explorer. – ak11234 – 2016-07-04T21:56:12.897

1This solution is a kind of workaround. I was looking for a more direct solution, but thanks. – Stamimail – 2016-07-07T13:10:48.000

instead of doing a mouse click, it's better to press the menu key on the keyboard which is called AppsKey in AHK

– phuclv – 2018-09-12T05:04:14.973

2The menu key should be used. The OP was asking for a "hotkey" not a mouse click. – Kai Noack – 2019-01-07T05:55:44.583

1Well, 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 – 2019-07-26T06:36:17.323

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.

pyrmont

Posted 2016-06-20T08:15:00.493

Reputation: 175

This is a quick solution that fits the bill of #hotkey perfectly. Thanks! – Eric Hepperle - CodeSlayer2010 – 2019-12-11T18:53:25.723

2

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.

NikosNachos

Posted 2016-06-20T08:15:00.493

Reputation: 21

Alt+H, W was answered by pyrmont days ago – phuclv – 2018-09-23T14:02:32.340

@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 – 2019-01-28T22:48:31.313

1

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"

RahimGM

Posted 2016-06-20T08:15:00.493

Reputation: 11