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 for using ListPerm.bat is:
ListPerm "Drive:\Folder" "ReportFile".
Where:
"Drive:\Folder" is the path to the folder you wish to enumerate. "ReportFile" is the fully qualified file name of the file that will contain the report.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% for /f "Tokens=*" %%a in ('dir /a /b /ad /s %pf%') do ( cacls "%%a">>%report% ) endlocal GOTO :EOF :bad @echo Usage: ListPerm "Drive:\Folder" "ReportFile" @echo. endlocal
0 comments
Hide comments