我是新來的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