> Now if you call aaa.bat its ECHO state will not be affected by the '@echo off' command found in the internal bbb.bat worker script. In this situation: aaa.bat - is my own script (that calls git.cmd) bbb.bat - is git.cmd
So you also mean that we need to fix git.cmd to make it preserving echo state? On Tue, Jun 24, 2008 at 9:59 AM, Jurko Gospodnetić < [EMAIL PROTECTED]> wrote: > Hi. > > It could be good to insert: @echo on at the end of the git.cmd file. >> This will make the git.cmd transparent when it is used in batch scripts. >> > > Here's a possible, if a bit verbose, way to detect the current ECHO state > at startup and then restore it on script exit: > > --- aaa.bat --- > echo kukuriku #1 from aaa.bat > call bbb.bat > echo kukuriku #2 from aaa.bat > --- end aaa.bat --- > > --- bbb.bat --- > @setlocal enableextensions > @for /F "usebackq tokens=3 delims=. " %%i in (`echo`) do @set > LOCAL__OLD_ECHO_STATE__bbb=%%i > @echo off > echo kukuriku from bbb.bat > echo %LOCAL__OLD_ECHO_STATE__bbb% > --- end bbb.bat --- > > Note that the long '@for...' line in the bbb.script will most likely be > split over multiple lines in your news reader. > > Now if you call aaa.bat its ECHO state will not be affected by the '@echo > off' command found in the internal bbb.bat worker script. > > This will not work when using the old Windows 95/95 command.com command > processor, but I personally have no problem with that. One way to make this > explicit is to use the .cmd extension instead of .bat. > > Hope this helps. > > Best regards, > Jurko Gospodnetić > > P.S. > My experience with batch files so far has been that when you need > something 'mysterious' supported - look at the 'for' command. That must be > one of the most overloaded command in the history of all scripting > languages. Yuch... > -- Roman Terekhov
