Solved

Creating an empty Notepad .txt file

Posted on 2006-10-20
4
849 Views
Last Modified: 2013-12-03
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

0
Comment
Question by:wheezle
4 Comments
 
LVL 8

Expert Comment

by:mxjijo
ID: 17777252

run this on cmd prompt

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

will create test.txt, size = 0

0
 
LVL 5

Accepted Solution

by:
NickGeorghiou earned 75 total points
ID: 17779500
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

0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 17786244
The following:

  echo on > test.txt

Seems to do that for me.
0
 

Author Comment

by:wheezle
ID: 17789635
Thanks NickGeorghiou -- and your one-liner made me smile: go banana!  :)  Awesome.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now