I want to write uprotect a ascii code file if it contains the word 0_MAIN in the first line. Does anybody know hoe to do this with a batch file?
If "uprotect" [sic] means unprotect: :: ===== script starts here ===============
::
:: shc.bat Tue 05-06-2012 9:06:48.32
@echo off & setLocal enableDELAYedeXpansioNset F=
for /f "tokens=* delims= " %%a in (myfile) do (
echo %%a | find "word" > nul && set F=Y
goto :done
)
:done
if defined F echo attrib -r myfile
goto :eof::====== script ends here =================
=====================================
Life is too important to be taken seriously.M2
Thx Mechanix!
what if there are multiple folders with multiple files and i want to unprotect all files in the folder with the one containing 0_MAIN.
Either put this FOR inside another FOR, or CALL it as a subroutine.
=====================================
Life is too important to be taken seriously.M2
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |