Nov 21, 2009

How To Use Command Prompt As A Text Editor

free web hosting
Open Discussion > MODERATED AREA > Tutorials

How To Use Command Prompt As A Text Editor

coolcat50
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.

 

 

 


Comment/Reply (w/o sign-up)

sunzoje
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?

Comment/Reply (w/o sign-up)

coolcat50
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.

Comment/Reply (w/o sign-up)

anachro
could you explain this better for people who don't get command prompt/learning command prompt?

Comment/Reply (w/o sign-up)

suberatu
I don't see myself using something like this anytime in the future, but knowledge is always a good thing. Thanks for the tutorial.

Comment/Reply (w/o sign-up)

FeedBacker
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)

Comment/Reply (w/o sign-up)

iGuest-Jesse
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

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : command, prompt, text, editor

  1. To Automatically Run Command When Login / Logoff
    (3)
  2. Create A Simple Html Editor With Php And Javascript
    (3)
    Ok, I will teach you how to create a simple HTML editor that runs online with buttons that add HTML
    tags. Before we start: You should have basic knowledge of these languages. HTML/XHTML
    Javascript PHP You will need Ability to use filesystem functions. Chmodding abilities
    Features of Editor Online PHP safe Full HTML support A Few Bad Features Can only create new
    documents or overwrite Fairly unsafe Now we are ready to begin. The PHP Script This will be
    our PHP script that we will use to make the file. Make a file called save.php Here is the....
  3. How To Make Pixel Text With Paint!
    Cool if you don't have photoshop or any of those (10)
    First you need a font called minimum +1 Follow these instructions CAREFULLY on how to install the
    font. If you're using firefox RIGHT CLICK on the link below and select "save link as"
    DOWNLOAD LINK READ THE ABOVE STUFF BEFORE CLICKING ON ME!!!! Then save it in your documents.
    Don't worry if firefox "quits" the download. As long as it is in your documents you're fine.
    ON IE.... Right click on link above and select "save traget as" Then go to start and open up
    "my documents". The font should be there. Keep that window open go to do "start" ....
  4. Sending + Receiving Email Via Telnet
    using email via the command line. (11)
    ok first off im no good at writing tutorials so feel free to flame me (hey that rymes). Anyway in
    this tutorial i will basically show you how to send and receive email via the command-line terminal
    emulation program called Telnet. Now where shall i start, hmm.. Sending Email!! Sending Email
    Sending email requires a special type of server called an SMTP server (SMTP -> Simple Mail Transfer
    Protocol). SMTP is the protocol used to send email just like POP is the protocol used to receive.
    Now by default and most commonly SMTP servers run on port 25. To describe a port i....
  5. Change / Modify The Title Bar Text In IE6 Or FF
    custom text in titlebar in ie or firefox (3)
    Changing The Text In The Bar (IE and Firefox Only) This will allow you to change the text in
    the title bar of either msie6 (may work for ie7 beta or earlier versions) and mozilla firefox 1.0.
    By default this is set to Microsoft Internet Explorer provided by ##### or Mozilla Firefox .
    Here's how to change that..... For Internet Explorer (6) Warning! Changing the title for
    internet explorer requires editing the registry. Making changes in the registry in keys or values
    that are not listed here could cause your computer to crash or slow. Follow the follow....
  6. Getting Started In Vb 6
    Printing out Hello World! in a text box. (0)
    Sorry for a duplicate post in Programming::VB Programming, I accidentally submitted this topic when
    I wasn't done. This example prints out Hello World! First launch VB 6. Second on the dialog
    that pops up create a New Standard Project and click Open. You should see this so far: Now
    click the A button in the toolbox to the left: Click the drag the object. Now click AB| next to
    the A in the toolbox. Drag it under Label1. Then click the button under the AB| and drag it under
    Text1. It should now look like this: Now that we have done adding objects to t....
  7. Delphi
    Simple Text Parsing Function (1)
    Because parsing is such an integral part of string manipulation, I took the time to make a quick and
    simple parse function. For you VBers, Delphi is a derivative of Pascal...it's powerful, simple,
    and (best of all) doesn't need external component (eg: ocx files). Hence the code: Code:
    function TForm1.SimpleParse(MainString, BeginString, EndString: string): string; var PosBeginString:
    integer; PosEndString: integer; begin PosBeginString := Pos(BeginString, MainString) +
    Length(BeginString); PosEndString := Pos(EndString, MainString); Result := Copy(MainString, ....

    1. Looking for command, prompt, text, editor

Searching Video's for command, prompt, text, editor
See Also,
advertisement


How To Use Command Prompt As A Text Editor

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com