batch file - ICACLS to change permission to a folder and its contents? -
i made piece of code change permission folder , contents (subfolders , files) command icacls
my issue : clicking on properties of folder > security can manually modify access rights of folder. there script or method prevent ?
@echo off title example of using icacls command hackoo 2017 mode con cols=70 lines=10 & color 0e set "folder=%userprofile%\desktop\testhackoo" if not exist "%folder%" md "%folder%" :main cls echo ================================== echo menu echo ================================== echo [1] control total echo [2] reading echo [3] writing echo ----------------------------------- echo( set /p "mychoice=please choose 1,2,3 : " if "%mychoice%" equ "1" ( icacls "%folder%" /grant:r "%username%:(oi)(ci)f">nul 2>&1 icacls "%folder%" /inheritance:r if "%errorlevel%" equ "0" ( cls & echo( & color 0a echo "%folder%" have control total ! timeout /t 1 /nobreak>nul explorer %folder% & exit ) else ( cls & echo( & color 0 echo command failure ! ) ) if "%mychoice%" equ "2" ( icacls "%folder%" /grant:r "%username%:(oi)(ci)r">nul 2>&1 icacls "%folder%" /inheritance:r if "%errorlevel%" equ "0" ( cls & echo( & color 0c echo "%folder%" reading ! timeout /t 1 /nobreak>nul explorer %folder% & exit ) else ( cls & echo( & color 0c echo command failure ! ) ) if "%mychoice%" equ "3" ( icacls "%folder%" /grant:r "%username%:(oi)(ci)w">nul 2>&1 icacls "%folder%" /inheritance:r if "%errorlevel%" equ "0" ( cls & echo( & color 0c echo "%folder%" writing ! timeout /t 1 /nobreak>nul explorer %folder% & exit ) else ( cls & echo( & color 0c echo command failure ! ) )
Comments
Post a Comment