If I understand correctly, what you are seeking is a way to "tee" the pipeline to both the console and a log file.
The tee
command has been in UNIX/Linux for a long time. No such thing in Windows cmd.exe. But, PowerShell does have Tee-Object
. At a PowerShell command prompt, use help Tee-Object -full
for more information.
powershell -NoLogo -NoProfile "& .\very_good02.bat | Tee-Object -FilePath 'C:\src\t\very_good02.log'"
Naturally, this is easier if your whole script is in PowerShell and not in cmd script language. You don't have to use PowerShell, but that is the clearly stated direction from Microsoft.
I am reminded that this can, actually, be done in a cmd .bat file script. Not easily, but it can be done. https://www.dostips.com/forum/viewtopic.php?p=32615#p32615 If anyone can do it in a .bat file script, Mr. Benham can.