How to get commnd prompt data to a file


  1. Posts : 228
    Win 10 Pro 64 Bit
       #1

    How to get commnd prompt data to a file


    I'm running a bat file in Command Prompt and want to capture it's output to a text file.
    I though "> filename" on the end of the command would redirect to a file, but it writes an empty file.
    Any solution ?
    Thanks.
      My Computer


  2. Posts : 13,933
    Windows 10 Pro X64 21H1 19043.1503
       #2

    You want to use 2>&1> filename. That should capture both error (stderror) and normal output in filename.

    For instance: dir c:\*.* 2>&1> c:\users\youraccountname\desktop\outfile.txt See later @Bree post
    Corrected: dir c:\*.* > c:\users\youraccountname\desktop\outfile.txt 2>&1

    will place the output of the dir command in the file outfile.txt on your desktop.

    If problems, post the contents of the batch file here and we can help get it working.
    Last edited by Ztruker; 28 Oct 2018 at 18:33.
      My Computers


  3. Posts : 228
    Win 10 Pro 64 Bit
    Thread Starter
       #3

    Yes I can get a file written with a directory listing, and if I don't specify a path it goes to the same folder (which is ok).
    But I cannot get the output sent to the file, it always prints to the console and writes an empty file. My batch file is

    ffmpeg.exe -nostats -i u80_258a.mp3 -filter_complex ebur128=peak=true -f null - 2>&1>outputfile9.txt
      My Computer


  4. Posts : 24,556
    10 Home x64 (21H2) (10 Pro on 2nd pc)
       #4

    In the words of the late great Eric Morcombe, you've got all the right notes, but not necessarily in the right order...

    Try: ffmpeg > output.txt 2>&1
      My Computers


  5. Posts : 228
    Win 10 Pro 64 Bit
    Thread Starter
       #5

    Brilliant! Yes, thanks very much all working now :)
      My Computer


  6. Posts : 24,556
    10 Home x64 (21H2) (10 Pro on 2nd pc)
       #6

      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 09:53.
Find Us




Windows 10 Forums