Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to send dos console output to a file?  (Read 2744 times)

0 Members and 1 Guest are viewing this topic.

vmars316

    Topic Starter


    Greenhorn

    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 7
    How to send dos console output to a file?
    « on: April 11, 2012, 05:46:08 PM »
    Dos cmd under windows7:
    Greetings,
    I need to know 2 things:
    1) How can I send dos console output to a file?
    2) And also how to display every console command.

    Thanks...vm
    www.vmars316.com
    "All things in moderation, except for love and forgiveness."

    Geek-9pm



      Genius
    • Geek After Dark
    • Thanked: 463
      • Geek 9pm blog
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows XP
    Re: How to send dos console output to a file?
    « Reply #1 on: April 11, 2012, 06:57:16 PM »
    This better not be homework...

    Assume d:\dos is valid directory
    Code: [Select]
    D:
    CD \DOS
    D:\DOS>help >help.txt

    In the D:\DOS directory you now have a file with the output.
    It is named:
    help.txt
    and can be opened with Notepad.



    vmars316

      Topic Starter


      Greenhorn

      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 7
      Re: How to send dos console output to a file?
      « Reply #2 on: April 11, 2012, 07:48:29 PM »
      Geek-9pm, Thanks.
      That is helpful.
      No worries, its not for homework.
      But how can i get a multiline output into ConsOut.txt for the following?:

      @echo on
      rem Compile myForm.d
      setlocal EnableDelayedExpansion
      set "DFL_LIB=C:\D\dmd2\windows\Dfl\import\dfl\win32\dfl\dfl.lib"
      set "DFL_IMPORT=C:\D\dmd2\windows\Dfl\import\"
      dmd -I %DFL_IMPORT% %DFL_LIB% myForm.d >ConsOut.txt
      pause

      How can i get it all output into ConsOut.txt ?
      Thanks...Vernon
      www.vmars316.com
      "All things in moderation, except for love and forgiveness."

      Geek-9pm



        Genius
      • Geek After Dark
      • Thanked: 463
        • Geek 9pm blog
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows XP
      Re: How to send dos console output to a file?
      « Reply #3 on: April 11, 2012, 08:46:59 PM »
      Quote
      How can i get it all output into ConsOut.txt ?
      Thanks...Vernon

      First item use:
      >ConsOut.txt
      the other items must be:
      >>ConsOut.txt

      The single > crates a file
      The double >> adds to a file


      vmars316

        Topic Starter


        Greenhorn

        • Computer: Specs
        • Experience: Familiar
        • OS: Windows 7
        Re: How to send dos console output to a file?
        « Reply #4 on: April 11, 2012, 09:35:39 PM »
        First item use:
        >ConsOut.txt
        the other items must be:
        >>ConsOut.txt

        The single > crates a file
        The double >> adds to a file


        Awesome!
        Its been years since i fiddled with Dos and cmd.exe .
        Anyways, I came up with a clutzy solution:

        ~myForm-compile-1.bat :
        DEL ~myForm-ConsOut.txt /P
        ~myForm-compile-2.bat > ~myForm-ConsOut.txt

        ~myForm-compile-2.bat :
        echo Compile myForm.d
        setlocal EnableDelayedExpansion
        set "DFL_LIB=C:\D\dmd2\windows\Dfl\import\dfl\win32\dfl\dfl.lib"
        set "DFL_IMPORT=C:\D\dmd2\windows\Dfl\import\dfl\win32\"
        dmd -I %DFL_IMPORT% %DFL_LIB% myForm.d

        ~myForm-ConsOut.txt :
        C:\D\dmd2\windows\Entice\vmPrograms\myForm>echo Compile myForm.d
        Compile myForm.d

        C:\D\dmd2\windows\Entice\vmPrograms\myForm>setlocal EnableDelayedExpansion

        C:\D\dmd2\windows\Entice\vmPrograms\myForm>set "DFL_LIB=C:\D\dmd2\windows\Dfl\import\dfl\win32\dfl\dfl.lib"

        C:\D\dmd2\windows\Entice\vmPrograms\myForm>set "DFL_IMPORT=C:\D\dmd2\windows\Dfl\import\dfl\win32\"

        C:\D\dmd2\windows\Entice\vmPrograms\myForm>dmd -I C:\D\dmd2\windows\Dfl\import\dfl\win32\ C:\D\dmd2\windows\Dfl\import\dfl\win32\dfl\dfl.lib myForm.d 

        Error: invalid file name 'C:\D\dmd2\windows\Dfl\import\dfl\win32\'

        Thanks a lot for your quick help...Vernon
        www.vmars316.com
        "All things in moderation, except for love and forgiveness."

        Geek-9pm



          Genius
        • Geek After Dark
        • Thanked: 463
          • Geek 9pm blog
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows XP
        Re: How to send dos console output to a file?
        « Reply #5 on: April 11, 2012, 10:43:35 PM »
        Glad to help.
        Be sure to spend some time in the DOS help area on CH.
        http://www.computerhope.com/jargon/d/dos.htm
        There you will find links to related topics.

        Joedude



          Rookie
          • Experience: Beginner
          • OS: Windows XP
          Re: How to send dos console output to a file?
          « Reply #6 on: April 27, 2012, 02:45:32 PM »
          Besides
          command > filename
          you can use
          command >>filename

          Squashman



            Apprentice
          • Thanked: 44
            • Experience: Experienced
            • OS: Other
            Re: How to send dos console output to a file?
            « Reply #7 on: April 27, 2012, 03:44:24 PM »
            Besides
            command > filename
            you can use
            command >>filename
            That was already clearly stated by Geek 16 days ago.

            patio

            • Moderator


            • Specialist
            • Maud' Dib
            • Thanked: 1247
              • Yes
            • Experience: Beginner
            • OS: Windows 7
            Re: How to send dos console output to a file?
            « Reply #8 on: April 27, 2012, 06:22:39 PM »
             ;)
               
            "
            All generalizations are false, including this one.  "

            Geek-9pm



              Genius
            • Geek After Dark
            • Thanked: 463
              • Geek 9pm blog
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows XP
            Re: How to send dos console output to a file?
            « Reply #9 on: April 28, 2012, 12:58:00 AM »
            This topic ought to be closed. Otherwise, he is relevant information. PowerShell enhances the redirection operators.
            Quote
            The operators implemented by Windows PowerShell to facilitate redirection are similar to those used in other shell environments. The full complement of these operators is outlined in the following table:

            Operator   Description
            >   Redirects output to specified file. If the file already exists, current contents are overwritten.
            >>   Redirects output to specified file. If the file already exists, the new output is appended to the current content.
            2>   Redirects error output to specified file. If the file already exists, current contents are overwritten.
            2>>   Redirects error output to specified file. If the file already exists, the new output is appended to the current content.
            2>&1   Redirects error output to the standard output pipe instead of to the error output pipe.
            Anyone wanting to expand his use of DOS should consider PowerShell. It is sorta like DOS, but it is better.
            It is in Windows 7. Download it for XP.

            Salmon Trout



              Sage

              Thanked: 654
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: How to send dos console output to a file?
            « Reply #10 on: April 28, 2012, 01:04:06 AM »
            Quote
            Operator   Description
            >   Redirects output to specified file. If the file already exists, current contents are overwritten.
            >>   Redirects output to specified file. If the file already exists, the new output is appended to the current content.
            2>   Redirects error output to specified file. If the file already exists, current contents are overwritten.
            2>>   Redirects error output to specified file. If the file already exists, the new output is appended to the current content.
            2>&1   Redirects error output to the standard output pipe instead of to the error output pipe.

            These are all available in the Windows cmd environment (the one people call "DOS" even though it isn't)

            Proud to be European - "Salmon Trout is the Gustavo Fring of batch coders" - Walter White.

            Geek-9pm



              Genius
            • Geek After Dark
            • Thanked: 463
              • Geek 9pm blog
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows XP
            Re: How to send dos console output to a file?
            « Reply #11 on: April 28, 2012, 01:29:47 AM »
            These are all available in the Windows cmd environment (the one people call "DOS" even though it isn't)
            Yes, and in DOS 7 you don't have CMD.
            It was not in  in Windows 98

            Quote
            “Loading COMMAND.COM” message can be seen on a HUD view of the Terminator and the internal viewport of RoboCop when he reboots.
            He should have use CMD.EXE  ---  RoboCop was DOS!

            Salmon Trout



              Sage

              Thanked: 654
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: How to send dos console output to a file?
            « Reply #12 on: April 28, 2012, 01:33:37 AM »
            Yes, and in DOS 7 you don't have CMD.

            Is this relevant to the OP's question? He or she wrote:

            Quote
            cmd under windows7


            Proud to be European - "Salmon Trout is the Gustavo Fring of batch coders" - Walter White.

            Geek-9pm



              Genius
            • Geek After Dark
            • Thanked: 463
              • Geek 9pm blog
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows XP
            Re: How to send dos console output to a file?
            « Reply #13 on: April 28, 2012, 01:47:13 AM »
            OK. You win.  :(

            Salmon Trout



              Sage

              Thanked: 654
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: How to send dos console output to a file?
            « Reply #14 on: April 28, 2012, 01:56:38 AM »
            OK. You win.  :(

            For my prize I claim a beer.

            Proud to be European - "Salmon Trout is the Gustavo Fring of batch coders" - Walter White.

            Geek-9pm



              Genius
            • Geek After Dark
            • Thanked: 463
              • Geek 9pm blog
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows XP
            Re: How to send dos console output to a file?
            « Reply #15 on: April 28, 2012, 02:00:03 AM »

            Anything else?

            Salmon Trout



              Sage

              Thanked: 654
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: How to send dos console output to a file?
            « Reply #16 on: April 28, 2012, 02:02:06 AM »
            Some nachos, please.

            Proud to be European - "Salmon Trout is the Gustavo Fring of batch coders" - Walter White.

            Geek-9pm



              Genius
            • Geek After Dark
            • Thanked: 463
              • Geek 9pm blog
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows XP
            Re: How to send dos console output to a file?
            « Reply #17 on: April 28, 2012, 02:18:00 AM »

            That is the lest of the nachos. The cook went home.