Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/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从文本文件复制项目_Powershell - Fatal编程技术网

Powershell从文本文件复制项目

Powershell从文本文件复制项目,powershell,Powershell,希望有人能帮忙 我在一个文本文件中有100行用于复制和粘贴文件 Copy-Item "Source\File123.txt" -Destination "Destination\Folder123" Copy-Item "Source\File542.txt" -Destination "Destination\Folder542" Copy-Item "Source\File567.txt" -Destination "Destination\Folder567" 如何让powershell

希望有人能帮忙

我在一个文本文件中有100行用于复制和粘贴文件

Copy-Item "Source\File123.txt" -Destination "Destination\Folder123"
Copy-Item "Source\File542.txt" -Destination "Destination\Folder542"
Copy-Item "Source\File567.txt" -Destination "Destination\Folder567"
如何让powershell通过加载文本文件来执行每一行

谢谢

……但这提出了一个问题。。你是如何得到一个包含命令的txt文件的。。?如果文件中只包含源和目标,则会容易得多

get-content C:\scripts\garbage.txt | % {Invoke-Command $([ScriptBlock]::Create("$_"))}