Infrastructure // PC & Servers
News
7/9/2011
10:29 PM
Connect Directly
RSS
E-Mail
50%
50%

Create a Text or Batch File from the Command Line in Windows

Use Windows command line to create batch files.

Sometimes you need to create a text file or you need someone else to. This is usually easy, but what if it needs to be a batch file and they have file extensions hidden?

Here's an easy way to make sure the correct extension is created with the file.

Go to Start and hit Run. Type:

CMD

Hit Enter.

From the command prompt, type: echo yourtexthereaswhateveryouwant > filename.fileextension

Hit Enter.

Here's how to create a file that will run the defragmentation engine in Windows as a batch file:

echo defrag c: > defragc.bat

Hit Enter.

The system will create the file in whatever folder the command line is operating in. In this case, that's my desktop. Note that there's no confirmation message.

Comment  | 
Print  | 
More Insights
Server Market Splitsville
Server Market Splitsville
Just because the server market's in the doldrums doesn't mean innovation has ceased. Far from it -- server technology is enjoying the biggest renaissance since the dawn of x86 systems. But the primary driver is now service providers, not enterprises.
Register for InformationWeek Newsletters
White Papers
Current Issue
InformationWeek Must Reads Oct. 21, 2014
InformationWeek's new Must Reads is a compendium of our best recent coverage of digital strategy. Learn why you should learn to embrace DevOps, how to avoid roadblocks for digital projects, what the five steps to API management are, and more.
Video
Slideshows
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
A roundup of the top stories and trends on InformationWeek.com
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.