How to copy command line text to a file?

how to store the contents on command prompt on to a file?? Is there any buffer log created? like we have in SQL? (the 'ed' command opens up the latest entry)
does anyone know about it??

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    You haven't mentioned whether you want the copy the contents manually or use commands to do so. Copying manually is easy. Assuming that you're in Windows environment, you'll have to right-click on the command prompt Window and select 'Mark'. Then select the text you want to copy and then Rt.Click -> Copy.

    I think you already know this. Please clarify your requirements.
  • Nayan Goenka
    Nayan Goenka
    After any command you execute, add this ">filename.txt". this will add the output of your command into thisfile. For ex:

    tracert CrazyEngineers > trace.txt

    This command will make a file trace.txt in your current working directory and copy all the output there instead of showing it on the screen.
  • Vishal Sharma
    Vishal Sharma
    I'm not being answered to what I've asked
    Leaving the manual stuff behind, I want to go for a programmatic way.

    After any command you execute, add this ">filename.txt". this will add the output of your command into thisfile. For ex:

    tracert CrazyEngineers > trace.txt

    This command will make a file trace.txt in your current working directory and copy all the output there instead of showing it on the screen.​
    yes, this works.. It is called re-directing and it works only with commands.. my question is not this. If something is already being displayed, that content should be moved to a text file. I think in linux we have script command to perform this kind of operation.. what about windows?
  • rukawa
    rukawa
    Vishal0203
    I think in linux we have script command to perform this kind of operation.. what about windows?

    What's the way to do this kind of operation in linux?
  • Vishal Sharma
    Vishal Sharma
    rukawa
    What's the way to do this kind of operation in linux?

    Script i think.. never used linux though.. got this suggestion from someone
  • sookie
    sookie
    Have you tried doskey /history >> commands.log ?
  • KenJackson
    KenJackson
    Vishal0203
    I think in linux we have script command to perform this kind of operation.. what about windows?
    Most things that you can do in Linux, including Script (Unix), you can do in the Cygwin environment in Windows. That is, download setup-x86.exe or setup-x86_64.exe from Cygwin and execute it to install a Linux-like tools for Windows. I couldn't use Windows without it.

You are reading an archived discussion.

Related Posts

When Firefox and Chrome are launching the developer versions, how can Opera stay back? With an attempt to provide an early glimpse (before a stable 17 version) to the users...
Here is the list of cute and deadly monsters cued to be unveiled in Frankfurt Autoshow 2013 to be held in Germany.Are you ready Guyssssssssssssssssssss.Here you goooooooooooo 1)Audi's A8 -...
We know that when a student finishes his medicine degree he must serve for a year in a rural village as a practitioner for an year. This is completely done...
Apple has already scheduled the release of ios7 later this year. Ios7 claims to be the world's most advanced mobile OS. It is clear from the figures that Iphone5 has...
Hey guys, we are daily discussing about the latest updates coming in smartphones. We try to judge the one we already have against the one we wish to hold. So...