Creating an empty Notepad .txt file

wheezle
wheezle used Ask the Experts™
on
Hi,

Is there a one-liner Run command to create an empty .txt file?

   Maybe something like:
   createcommand "" > file1.txt

   (Right-clicking the mouse and selecting "New: Text File Type" does it somehow...)

For many Bonus points:
Is there a one-liner Run command to pop-up a dialog to choose the filename and then create an empty .txt file?

Thanks for your ideas!
wheezle

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:

run this on cmd prompt

copy con test.txt <enter>
^Z <enter>

will create test.txt, size = 0

What about:

1. Create an empty text file and call it "template.txt". Put this file in a known location e.g. c:\windows or c:\winnt depending on which operating system you are using.

2. Create a batch file and also put it in c:\windows since this is location is in the path. Call the batch file something like "txt.bat".

3. The contents of the batch file would be something like:

echo off
copy c:\windows\template.txt %1.txt



So from a command prompt at any location you can simply type, for example,

 txt banana

and it will create an empty text file in that directory called banana.txt

The following:

  echo on > test.txt

Seems to do that for me.

Author

Commented:
Thanks NickGeorghiou -- and your one-liner made me smile: go banana!  :)  Awesome.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial