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

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 Government, May 2014
Protecting Critical Infrastructure: A New Approach NIST's cyber-security framework gives critical-infrastructure operators a new tool to assess readiness. But will operators put this voluntary framework to work?
Video
Slideshows
Twitter Feed
Audio Interviews
Archived Audio Interviews
GE is a leader in combining connected devices and advanced analytics in pursuit of practical goals like less downtime, lower operating costs, and higher throughput. At GIO Power & Water, CIO Jim Fowler is part of the team exploring how to apply these techniques to some of the world's essential infrastructure, from power plants to water treatment systems. Join us, and bring your questions, as we talk about what's ahead.