我是新来的powershell,也是编程方面的新手。 我想获得一个脚本来搜索所有类型的文件,并将其放入一个文件夹。Get-Childitem:非法字符路径错误
但它给了我错误;
Get-Childitem:illegal character path
$extensions = '*.xls*', '*.docx*', '*.txt', '*.pdf', '*.jpg', '*.pub'
Get-Content C:\scripts\computer\computers.txt | % {
$ComputerName = $_
$dst ="\\192.168.1.11\public\$ComputerName"
$src ="\\$ComputerName\*``\desktop"
New-Item -ItemType Directory $dst
Get-Childitem $src -Include $extensions -Recurse -Force |
Copy-Item -Destination $dst
}
是什么原因造成的?
这是问题:'\\ $ ComputerName \ *''\ desktop' – arco444