windows - Hide logical construct in batch file, but show commands actually executed -
windows - Hide logical construct in batch file, but show commands actually executed -
i have batch file in have if/else if block. not want block "echoed" user, doing prints total screen of complex logic hard understand what's executing out of it. however, commands executed within block echoed user.
putting @ in front end of first if hides entire statement , there doesn't seem way "unhide" portions. attempting utilize @echo off , @echo on turn screen reporting off main statement , on logic branches doesn't seem either. help?
it's not pretty, works:
@echo off if 1==1 ( echo on %%a in (1) echo command 1 %%a in (1) echo command 2 )
you can lessen amount of typing little macro. illustration shows how handle embedded command. @ in front end of () results echo off commands within do() clause. without it, whole (...) echoed each command within.
@echo off setlocal set show=for %%a in (1) if 1==1 ( echo on %show% echo command 1 %show% echo command 2 /l %%n in (1 1 5) @( %show% echo loop %%n command shown echo loop %%n b command not shown ) )
windows command-line batch-file
Comments
Post a Comment