View Full Version : Any way to create new text file anywhere?

17-05-2010, 10:00 PM
Hey ya guys

Just got a quick question, Im aftering a method that can allow me to create a new text file in a folder in an instant. Something along the line of a hotkey or via the context menu. And I dont mean the traditional Right Click>New>Text Document. I need something that I can do within a click or a press of a button.

At the moment Ive been searching for some hacks or mods the explorer tool bar to incorporate this function, but sadly such usage on creating a new text file is not so common.

So if any one has some tips or hints on the ability to create new text document in an instant or within a click or press of a button, please let me know :)

Thank you guys in advance :thanks

17-05-2010, 10:17 PM
Do you want it to open with a new blank txt file, or a shut one as you described with the right click.

17-05-2010, 10:24 PM
Yeah, pretty much just a new text document in a folder like it would be as if I used the usual right click>new>... method. But if it is able to be opened up after it is created, I am also fine with that, would save me a few clicks to get it opened ^^

17-05-2010, 10:25 PM
Probably a batch file or script would be the way to go.

Here's a mthod to create a text file with a file list in it. And add to the right click menu.


Speedy Gonzales
17-05-2010, 10:35 PM
Well if you wanted to use notepad, you could just put a hotkey under its properties alongside shortcut key. You wouldnt have to make a shortcut for it .

It wouldnt be in any particular folder. But, all you would do, is press a key / an F key, and it'll run

17-05-2010, 10:49 PM
Hey ya guys

Thanks for the prompt update.

The site's instruction is close to what Im looking for, just now need to find a way to call it in any folder and pick up its dir...majority of the time, the text file would be created inside the folder, rather than prior to entering the folder. Though great stuff, does give me a some more ideas on how I can go about doing this.

As for the notepad shortcut property, I did look into that, but sadly the need to Save As is a put off ><. Very close but not quite there v_v

18-05-2010, 12:30 AM
Hey ya guys

Sort of managed to get a work around for the problem. This is for future reference for anyone who is aftering the same functionality.

1. Create a .bat file with the following command
IF EXIST info.txt goto exists
echo on>info.txt
goto end
echo on>info2.txt

2. Create a semi-context menu link to the file by creating a new registry key with a command key under [HKEY_CLASSES_ROOT/*/shell]

Example: HKEY_CLASSES_ROOT/*/shell/NewTxt/Command

3. Change the Command Default value to the path of where the .bat file was save/located at.

Example: C:\addnewtxt.bat

So now, whenever you right click on a file in any folder, a NewTxt command will be available for you to create a new text file. However right clicking in empty space within any folder wont give the correct context menu with the NewTxt command.

Although my problem is slightly solve, Im still abit unsatisfied. For 2 reasons:

1. The code cant detect existing info.txt files. Does any one know how I can modify the code to detect existing info.txt file and create another with an auto-increment number? Btw, Im no coder, hence the question ^^

2. The NewTxt command only displays in the context menu when clicked on a file, not in empty space. Anyone know how I can move the command into your typical context menu, where it will display it when right click in an empty space in a folder?

Thank you in advance ^^

18-05-2010, 07:40 AM
I notice in the registry that there is a key called

HKLM\SOFTWARE\Classes\Directory\Background\shellex \ContextMenuHandlers\

Looks like where you should be starting...

18-05-2010, 07:42 AM
To create a system where the number increments each time you create another, you would need to use a FOR loop. For more details type FOR /? at the command prompt or search Google.

18-05-2010, 10:48 AM
FWIW, I just create shortcuts to Word Pad & New Word Doc, then drag them down to the Task Bar. May need to unlock it.
Left click opens them, always visible, can delete the Desktop shortcuts if wanted.

18-05-2010, 04:45 PM
Thanks a lot for everyone's update.

Will take a look into the shellex \ContextMenuHandlers\ section.

As for the for loop, what exactly is this coding called? Is it windows shell cmd? Ive been searching for .bat syntax and cmd syntax and now completely confused.

As for the word pad tip, much appreciated, though am looking for a way that can create a instant file rather than just launching the application. Would hate to save-as every single docu file ><

Thanks again everyone

Speedy Gonzales
18-05-2010, 05:13 PM
Well it doesnt matter what you want. You''ll still have to type something (otherwise there's no point in creating a txt file). And you'll have to select save as somehow, if you want to save it. If you cant be bothered doing it like everyone else, use speech. Then the only thing you'll have to open is your mouth

18-05-2010, 07:28 PM
Thanks for the idea, speech is something that I've forgotten, though with the need of a mic and all, I think i'll stick with the hotkeys or script files.