Infrastructure // PC & Servers
News
7/9/2011
10:29 PM
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 Tech Digest, Dec. 9, 2014
Apps will make or break the tablet as a work device, but don't shortchange critical factors related to hardware, security, peripherals, and integration.
Video
Slideshows
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
Join us for a roundup of the top stories on InformationWeek.com for the week of December 7, 2014. Be here for the show and for the incredible Friday Afternoon Conversation that runs beside the program!
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.