JSI Tip 9640. How do I print permissions on a folder tree using standard commands?

Jerold Schulman

August 16, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today


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 offsetlocalIF {%1}
{} GOTO badIF NOT EXIST %1 GOTO badIF {%2}
{} goto badset pf=%1set report=%2if exist %report% del /q %report%cacls %pf%>%report%for /f "Tokens=*" %%a in ('dir /a /b /ad /s %pf%') do ( cacls "%%a">>%report%)endlocalGOTO :EOF:bad@echo Usage: ListPerm "Drive:Folder" "ReportFile"@echo.endlocal



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like