Solved

Creating an empty Notepad .txt file

Posted on 2006-10-20
4
866 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…

726 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