Saturday, 2 January 2010

Notepad: save non-TXT files without .txt ending e.g. html files

I still often use Notepad in Windows for quickly producing simple html or js files and the like.

One pain is that when you "Save" or "Save as" a file in Notepad, the program automatically sticks a "txt" at the end of the filename so you end up with a file called something like "/2010/01/myfile.html.txt" - which really doesn't work properly as an html file (or whatever) until you rename it to get rid of the "/2010/01/.txt". Or you have to change the "Save as type" box, which is an extra step.

Here's a tip which I only recently discovered, I don't recall where from, which saves you all that hassle - read on for how to save non-text files quickly without a .txt being appended to the end of the file name.

When you choose Save or Save as, in the File Name box just type the name of your file with .html or .htm (or whatever extension you need) as the ending, but surround the filename with doublequotes. NOT single quotes, it has to be double quotes (Shift 2 usually). Like this, where I've used "myfile.html" as the filename:

Then choose your file location and Save it, and you'll find that even though you didn't touch the "Save as type" box, it's been saved with exactly the right file extension - no annoying extra "txt" at the end. I love tricks like these!

3 comments: said...

Funny, I never had this problem. Turns out it's because I've always disabled the 'Hide extensions for known file types' under the Folder Option in Windows Explorer when I installed Windows. With that, you can type in name.html or whatever, without needing the double quotes.

Indramohan said...

no, In that case you will have to change file type to all files *.*, that is all.

Improbulus said...

Using the quotes saves you having to go to the dropdown to choose "all files". 1 step less, makes a difference to me!