的foreach用户的子文件夹
问题描述:
我需要去某个文件为我们的用户共享每个用户名:的foreach用户的子文件夹
\\\server\share\username\windows\application Data\MICROSOFT\Proof\custom.dic
如何代码foreach
从根过去每个用户名听到了吗?
答
实施例:
Get-ChildItem \\computerName\share | ?{$_.PsIsContainer} | %{$localDir='c:\localDir'}{Copy-Item "\\computerName\share\$($_.Name)\a.txt" "$localDir\$($_.Name)_a.txt"}
答
使用通配符为用户名:
Get-ChildItem '\\server\share\*\windows\application Data\MICROSOFT\Proof\custom.dic'