I have a very small batch script which is extracting a quite amount of files.
The script is meant to be delivered with the compressed data to other users.
Now my problem is that this compression tool is outputting a ton of data into the cmd window.
I think this will confuse a lot of useser because the output is really “running”. It basically shows a percentage with each line and how it decompressed at which speed (CPU and HDD).
A lot of confusing data that no one needs to see. Now I don’t really like suppressing all the output of the program, giving the user feedback on how far the decompression already got would be important in my opinion.
So is it possible to redirect the output and read just the first three digits of that output and deliver that to the users in a single line? So the users only sees an advancing percantage (in one line) and not 20 new lines every second with all this data?
Here an example of how it looks at the moment:
https://i.stack.imgur.com/guTYP.png
The compression tool is SREP, my OS Win 7 x64.
Here is a simple hybrid batch/JScript script that I think will do what you want.
show3.bat
Usage:
The script could be simplified to pure JScript, but then it won’t be as convenient to use:
show3.js
Usage:
EDIT As jeb commented, you should not need any redist to use this solution.
I’ve taken some of the concepts in jeb’s answer and combined the entire process into one hybrid script. No need for a standalone “show3” file.
yourCommandwould be whatever compression command you are using. Based on your comments, it sounds like you might have to useyourCommand 2>&1if the output you want is printing to stderr instead of stdout.I’ve created a “yourCommand.bat” file for testing purposes. It crudely emulates the output behavior you describe for your compression program.
Finally, if you really want a pure batch solution, I greatly simplified jeb’s solution. I eliminated the temp file and used a pipe instead.
Edit – I modified the EOF test to ignore any leading or trailing spaces. This should make the code more robust.