Solved

Creating an empty Notepad .txt file

Posted on 2006-10-20
4
853 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Duplicates in Aggregate Query 3 33
Build VS2015 project in bat command 3 80
Problem to file 3 67
Recommendation vb6 to vb.net or others 14 109
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 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

24 Experts available now in Live!

Get 1:1 Help Now