I'm asking in the wider forum in case someone might have a solution ising findstr or something.
I want to parse the output from this:
Code: Select all
C:\>icacls "c:\Program Files\Common Files"
c:\Program Files\Common Files NT SERVICE\TrustedInstaller:(F)
NT SERVICE\TrustedInstaller:(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(M)
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
BUILTIN\Administrators:(M)
BUILTIN\Administrators:(OI)(CI)(IO)(F)
BUILTIN\Users:(RX)
BUILTIN\Users:(OI)(CI)(IO)(GR,GE)
CREATOR OWNER:(OI)(CI)(IO)(F)
The only problem I have is the first line of output:
Code: Select all
c:\Program Files\Common Files NT SERVICE\TrustedInstaller:(F)
The output I want is this (with all preceeding / trailing <TABS>, <SPACES> trimmed):
Code: Select all
NT SERVICE\TrustedInstaller:(F)
NT SERVICE\TrustedInstaller:(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(M)
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
BUILTIN\Administrators:(M)
BUILTIN\Administrators:(OI)(CI)(IO)(F)
BUILTIN\Users:(RX)
BUILTIN\Users:(OI)(CI)(IO)(GR,GE)
CREATOR OWNER:(OI)(CI)(IO)(F)
The folder path: "c:\Program Files\Common Files" will change - This needs to work for an unknown number of <folder paths> which may include [spaces], [!], etc. - basically all allowable NTFS file naming characters. I do have a work-a-round so this is not critical but would love to have a simpler solution if one is available.