> I'd like to argue that most scripts on Windows normally turns off echo as the first thing they do. I did not know about it. If it is normal to turn off echo, let it be the way it coded now. I can fix git.cmd on my own PC.
The script example you send does not help, because after each call to git.cmd echo is disabled. The solution can be to execute @echo on after each git.cmd, but I am not shore whether it is the right way to code. It should be so if "most scripts on Windows normally turns off echo as the first thing they do". > @ECHO | c:\WINDOWS\system32\find.exe "ECHO is off." >NUL > @SET EchoWasOff=%ERRORLEVEL% As I understood, these lines should find out the state echo (whether it is ON or OFF). But I always get EchoWasOff = '1' :-( On Tue, Jun 24, 2008 at 8:45 AM, Marius Storm-Olsen <[EMAIL PROTECTED]> wrote: > Roman Terekhov said the following on 23.06.2008 14:03: > >> I like to write batch scripts to execute several git commands at >> the same time. Now the @echo off (in the first line of the git.cmd) >> disables echo, so that I am not able to see which command are >> executing (except for the very first one :-) >> >> With other words, now the git.cmd batch performs two distinct >> tasks: - execute git.exe in the proper way - disables echo (while >> ideally it should preserve the echo state that was before git.cmd >> execution) >> >> The last task does not look to be natural for the git.cmd at all. I >> don't know how to preserve the original echo state (after git.cmd >> execution), but if git.cmd switch off echo at the start, it should >> switch it on back at the end. It is just my personal meaning of >> course, and nothing more. >> > > I'd like to argue that most scripts on Windows normally turns off echo as > the first thing they do. If that holds true, shouldn't it then rather be > *your* job to ensure that *your* script works the way *you* intended it to, > independently of what others do? > > I mean, it's really not that hard. Try this, for example: > @SETLOCAL > @ECHO | c:\WINDOWS\system32\find.exe "ECHO is off." >NUL > @SET EchoWasOff=%ERRORLEVEL% > @ECHO on > > ECHO Do stuff youd like echoed here > > @REM Turn off echo again, if caller liked that > @IF "%EchoWasOff%" EQU "1" ECHO off > > If you use that as your boilerplate for BAT scripts, you should always get > what you want.. > > -- > .marius > -- Roman Terekhov
