Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell:icACLs在带有空格的路径上阻塞_Powershell_Robocopy_Icacls - Fatal编程技术网

Powershell:icACLs在带有空格的路径上阻塞

Powershell:icACLs在带有空格的路径上阻塞,powershell,robocopy,icacls,Powershell,Robocopy,Icacls,我正在遍历一个目录结构,并使用icACLs.exe保存其内部每个目录的权限。我需要使用robocopy查找所有路径,因为很多完整路径的长度超过260个字符。有些还包括空格 我似乎有足够好的工作,直到它的空间,然后我得到- icacls.exe:Y:/this/path/has/spaces/in/it”/save Perms.txt:文件名、目录名或卷标语法不正确 这是我的密码: robocopy Y:\Public NULL /l /e /nfl /xx /nc /ns /njh | Out-

我正在遍历一个目录结构,并使用icACLs.exe保存其内部每个目录的权限。我需要使用robocopy查找所有路径,因为很多完整路径的长度超过260个字符。有些还包括空格

我似乎有足够好的工作,直到它的空间,然后我得到-

icacls.exe:Y:/this/path/has/spaces/in/it”/save Perms.txt:文件名、目录名或卷标语法不正确

这是我的密码:

robocopy Y:\Public NULL /l /e /nfl /xx /nc /ns /njh | Out-File Y:\results.txt
$results = Get-Content Y:\results.txt
ForEach ($sfile in $results) {
    $sfile = $sfile.Trim()
    cd $sfile
    New-Item -Name Perms.txt -ItemType File -force
    icacls.exe "$sfile" /save Perms.txt    
}
我尝试过在引号和大括号中包含$sfile,但我似乎无法让它顺利通过它们。我还注意到,所有带空格的路径在错误中似乎都以双引号结尾,尽管我不确定原因。想法?

icacls.exe“'$sfile”“/save Perms.txt
?还考虑查看获取ACL和设置ACL CMDLET。