![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-11 09:06 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » How to output the _final_ screen display from a batch file to a file? |
| Printable Version 1,112 / 11 |
| Floor1 noe | Posted 2009-02-07 16:51 |
| 新手上路 Posts 9 Credits 17 | |
|
As the title says.
For example, there is a bat file. After it finishes running and pause is reached, I can Select All in the cmd window, copy it, and save it as text. What I want is a way to save this text automatically. An example will make it easier to explain.The example is only for illustration, not a request for a solution to this specific case. Suppose there is a batch file that converts wav to flac. flac.exe test.wav While it runs, the screen keeps updating with the progress. When it finishes, it gives final information such as the final file size and compression ratio. (If that's not clear enough, please look at the pictures. During run 1: ![]() During run 2: ![]() Final screen display: ![]() This final screen display information is what I want. If I use 2>log, then the file I get is something like this: flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson But what I want is what is shown in the final screen display, without so many lines in the middle, in a file in a format like this: flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson The above example is only for illustration, not a request for a solution to this specific case. Is there any command or tool that can do this? Please advise. Thanks. PS, what I want is to get such a file directly, not to process the log with a tool after it finishes. [ Last edited by noe on 2009-2-8 at 23:07 ] |
|
| Floor2 slore | Posted 2009-02-07 17:00 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
| Floor3 noe | Posted 2009-02-07 21:04 |
| 新手上路 Posts 9 Credits 17 | |
Originally posted by slore at 2009-2-7 05:00 PM: Thanks. But the flac example I gave above was only an example. Using findstr does not seem to work generally for other cases. Is there a more generally applicable method? |
|
| Floor4 netbenton | Posted 2009-02-07 21:40 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
Is it the first three lines and the last line?
|
|
| Floor5 noe | Posted 2009-02-08 12:50 |
| 新手上路 Posts 9 Credits 17 | |
Originally posted by netbenton at 2009-2-7 09:40 PM: Hello. What I want to find is a general solution. The example here is only for ease of explanation and use. What I need is what the title says: output the _final_ screen display to a file. |
|
| Floor6 netbenton | Posted 2009-02-08 13:00 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
Give another different example and let us see. If the program is supposed to be general, then you have to find what different examples have in common and handle that; otherwise, it can't be written.
|
|
| Floor7 noe | Posted 2009-02-08 20:04 |
| 新手上路 Posts 9 Credits 17 | |
Originally posted by netbenton at 2009-2-8 01:00 PM: Hello. Let me put it another way. There is a bat file. After it finishes running and pause is reached, I can Select All in the cmd window, copy it, and save it as text. What I want is a way to save this text automatically. What I do not want is a method for how to process the log file after redirecting stderr to a log file. |
|
| Floor8 yishanju | Posted 2009-02-08 20:09 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
| Floor9 noe | Posted 2009-02-08 23:05 |
| 新手上路 Posts 9 Credits 17 | |
Originally posted by yishanju at 2009-2-8 08:09 PM: Thanks for your reply. But it would be better if you could read the post before replying; it would save both your time and mine. What I want is not a solution for this specific example. |
|
| Floor10 yishanju | Posted 2009-02-08 23:21 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
You really are hard to understand
|
|
| Floor11 yishanju | Posted 2009-02-08 23:23 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
Could you re-upload the pictures
Upload pictures that can be seen clearly |
|
| Floor12 netbenton | Posted 2009-02-08 23:33 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
@echo off
::%1 is the specified output filename, otherwise output to abcec.txt ::Batch file for saving the entire screen under DOS, does not support Chinese goto :begin f 100 l14 B8 00 B8 50 1F BF 00 02 B9 D0 07 BD 02 08 BA 50 00 AD 3C 20 f 114 l14 75 03 43 75 02 31 DB AA 4A 75 0D B8 0D 0A 29 DF 29 DD 31 DB f 128 l0e AB BA 50 00 E2 E3 06 1F 89 E9 31 DB 90 90 t=100 g 134 w 200 q :begin if '%1'=='' set of=abcec.txt debug %1%of%<%~f0>nul start notepad %1%of% [ Last edited by netbenton on 2009-2-9 at 00:33 ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |