.
This commit is contained in:
parent
81216ee318
commit
659ce766a4
45
tools/setgroup-noaccess.cmd
Normal file
45
tools/setgroup-noaccess.cmd
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
IF %1.==. GOTO USAGE
|
||||||
|
IF %2.==. GOTO USAGE
|
||||||
|
|
||||||
|
if /I %1 == %SystemDrive% goto nosystemdrive
|
||||||
|
if /I %1 == %SystemDrive%\ goto nosystemdrive
|
||||||
|
|
||||||
|
if NOT EXIST %1 (
|
||||||
|
echo ERROR: file or directory not found!
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
echo removing access rights for Group [ %2 ] on [ %1 ] ...
|
||||||
|
|
||||||
|
if EXIST %1\* (
|
||||||
|
|
||||||
|
echo *** DIRECTORY mode ***
|
||||||
|
takeown /F %1 /R /A /D Y 1>nul
|
||||||
|
icacls %1 /inheritance:r
|
||||||
|
icacls %1 /grant Administrators:F /t /c /l /q
|
||||||
|
icacls %1 /remove %2 /t /c /l /q
|
||||||
|
|
||||||
|
) else (
|
||||||
|
|
||||||
|
echo *** FILE mode ***
|
||||||
|
takeown /F %1 /A 1>nul
|
||||||
|
icacls %1 /inheritance:r
|
||||||
|
icacls %1 /grant Administrators:F /c /l /q
|
||||||
|
icacls %1 /remove %2 /c /l /q
|
||||||
|
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
icacls %1
|
||||||
|
GOTO END
|
||||||
|
|
||||||
|
:nosystemdrive
|
||||||
|
echo ERROR: cannot use the SystemDrive!
|
||||||
|
GOTO END
|
||||||
|
|
||||||
|
:USAGE
|
||||||
|
echo "usage: %0 <path> <group>"
|
||||||
|
|
||||||
|
:END
|
||||||
|
|
Loading…
Reference in New Issue
Block a user