Here is a simple hybrid / JScript script package that I think will do what you want.
show3.bat
@if (@X)==(@Y) @end
while( !WScript.StdIn.AtEndOfStream ) {
WScript.StdOut.Write( '\x08\x08\x08' + WScript.StdIn.ReadLine().substr(0,3) );
}
WScript.StdOut.WriteLine();
Using:
yourCommand | show3
the script can be simplified to pure JScript, but then it will not be so convenient:
show3.js
while( !WScript.StdIn.AtEndOfStream ) {
WScript.StdOut.Write( '\x08\x08\x08' + WScript.StdIn.ReadLine().substr(0,3) );
}
WScript.StdOut.WriteLine();
Using:
yourCommand | cscript
EDIT As jeb commented, you won't need to use redist to use this solution.
I took some of the concepts in a jeb answer and combined the whole process into one hybrid script. There is no need for a separate show3 file.
@if (@X)==(@Y) @end
while( !WScript.StdIn.AtEndOfStream ) {
WScript.StdOut.Write( '\x08\x08\x08' + WScript.StdIn.ReadLine().substr(0,3) );
}
WScript.StdOut.WriteLine();
yourCommand , . , , yourCommand 2>&1, stderr stdout.
"yourCommand.bat" . , .
@echo off
for /l %%A in (1 1 100) do (
echo %%A "I don't want to see this quoted text"
for /l %%B in (1 1 50000) do rem
)
, , jeb. .
@echo off
if "%~1"==":show3" goto :show3
REM whatever batch code you need goes here
(yourCommand & echo EOF) | "%~f0" :show3
REM whatever batch code you need goes here
exit /b
:show3
setlocal enableDelayedExpansion
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
:read
set "ln="
set /p "ln="
if not defined ln goto :read
for /f "tokens=1* delims= " %%A in ("!ln!") do if "%%A%%B" equ "EOF" (
echo(
exit /b
)
<nul set /p "=!ln:~0,3! !cr!"
goto :read
. EOF, . .