You are not logged in.
Pages: 1
Good-day
It appears that the echo state cannot be overridden in an if subclause.
I want the subcommands to echo, but not the if. The intent in the following should be clear, but the result is no output at all:
set var=on
@echo off
if %var%=on (
echo on
attrib /s +r c:\data_backup
@echo off )
This is just out of curiosity; obviously I can "echo attribs applied" as a workaround (and you might say that that's better, but I still want to know).
Cheers
Brian
Offline
The code block is part of the if statement, which currently falls under @echo off. You can achieve the desired result if you put the code in a subroutine:
@echo off
set var=on
if "%var%"=="on" (
call :make_readonly
)
exit /b
:make_readonly
echo on
attrib /s +r C:\data_backup
@echo off
Offline
Most kind of you, good sir! :-)
Offline
Pages: 1