Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> How To Use Command Prompt As A Text Editor
coolcat50
post Jan 26 2008, 06:02 PM
Post #1


Super Member
*********

Group: [HOSTED]
Posts: 280
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



In this tutorial, I will show you how you can use Command Prompt to create text files. It is very simple and you can also use it to write output from a command into a text file. This can be particularly useful when you need documentation from a DOS program in a text file when you use the help command or something similar.

In order to do this you simply use this DOS command.
CONSOLE

echo Text >> test.txt


This will create a new text file called test and echo the contents into it. If we wanted to write a 2 line document, we could do something like:
CONSOLE

echo Hello >> test.txt
echo Person >> test.txt


The Command Prompt automatically does linebreaks each time the command is used.

I also stated that you can put documentation into a text file this way.
I will use the Perl documentation command as an example.
CONSOLE

perldoc perl >> perldoc.txt


That will put the output from perldoc into the file perldoc.txt.

Thanks for reading this material and have fun doing text writing the old school way.
Go to the top of the page
 
+Quote Post
sunzoje
post Feb 1 2008, 01:28 AM
Post #2


Member [Level 1]
****

Group: Members
Posts: 57
Joined: 22-March 07
Member No.: 40,467



It's really nice. But what if I have to create multiple line documents. Can I just type and echo it to the txt file?
Go to the top of the page
 
+Quote Post
coolcat50
post Feb 2 2008, 06:50 PM
Post #3


Super Member
*********

Group: [HOSTED]
Posts: 280
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



Whenever you use the echo command, it automatically creates a linebreak. I think it might not be able to create linebreaks in a single echo statement though.
Go to the top of the page
 
+Quote Post
anachro
post Feb 8 2008, 04:58 PM
Post #4


Member [Level 1]
****

Group: Members
Posts: 68
Joined: 7-January 08
Member No.: 55,865



could you explain this better for people who don't get command prompt/learning command prompt?
Go to the top of the page
 
+Quote Post
suberatu
post Feb 10 2008, 03:27 AM
Post #5


Advanced Member
*******

Group: Members
Posts: 132
Joined: 23-September 07
Member No.: 50,511



I don't see myself using something like this anytime in the future, but knowledge is always a good thing. Thanks for the tutorial.
Go to the top of the page
 
+Quote Post
iGuest
post Mar 3 2008, 09:22 PM
Post #6


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Replying to suberatu

What if I want edit the first line of a text document "//Easting, Northing, Depth" to be "Easting, Northing, Depth" but the file is too large to open in any text editing program (700 mb)
Go to the top of the page
 
+Quote Post
iGuest
post Jul 10 2008, 05:08 PM
Post #7


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Well that is one way to do it, but an easier way to edit text is available. Pretend we have a file in our desktop called "test.Txt" without the quotations. To edit this file, you can type the following command:

Copy con test.Txt

To use this, you should be in the same directory as the file, so, in a Windows computer your command would actually look like this:

C:\Documents and Settings\User\Desktop> copy con test.Txt

BE WARNED: This overwrites ALL OF YOUR TEXT! It is very useful to create a new document, but for editing an existing document it would be easier to just type this:

Notepad test.Txt

So it opens instead of overwriting

-reply by Jesse
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Delphi(1)
  2. Change / Modify The Title Bar Text In IE6 Or FF(3)
  3. Sending + Receiving Email Via Telnet(8)
  4. Chat With Command Prompt(26)
  5. Flatfile User Login/signup(24)
  6. How To Make Pixel Text With Paint!(10)
  7. To Automatically Run Command When Login / Logoff(3)


 



- Lo-Fi Version Time is now: 25th July 2008 - 09:05 PM