NOTE: See tip 9640 » How do I print permissions on a folder tree using standard commands?
There are many ways to accomplish the subject task.
In tip 5640, we set permissions on user home folders. In tip 5645, I introduced FORFILES. In tip 0425, I explained how to read the permissions displayed by the CACLS command.
I have scripted ListPerm.bat, to display the permissions of a folder tree. The syntax is:
ListPerm "Drive:\Folder" "ReportFile".
ListPerm.bat contains:
@echo off setlocal IF \{%1\}\{\} GOTO bad IF NOT EXIST %1 GOTO bad IF \{%2\}
\{\} goto bad set pf=%1 set report=%2 if exist %report% del /q %report% cacls %pf%>%report% forfiles -p%pf% -s -c"CMD /c if @ISDIR==TRUE cacls 0x22@FILE0x22>>%report%" endlocal GOTO :EOF :bad @echo Usage: ListPerm "Drive:\Folder" "ReportFile" @echo. endlocal
0 comments
Hide comments