Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Creating an empty Notepad .txt file

Posted on 2006-10-20
4
Medium Priority
?
899 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 300 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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 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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

810 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