I would like to write a script which lists/exports the permissions of the directories in Path.
To get the path variables I use $env:Path
but this lists the variables as one large string. How can I get the variable in a object to proceed further? Next, I would like to get the permissions get-acl
.
Thanks for your support.
DonQui
Use the -split
operator to split the string like so,
$arr = $env:path -split ";"
$arr
%SystemRoot%\system32\WindowsPowerShell\v1.0\
C:\windows\system32
C:\windows
...
The $arr
variable contents can be piped to, say, foreach
for further processing like so,
$arr | % {
$_
}