【发布时间】:2011-10-03 22:53:40
【问题描述】:
我正在尝试从 txt 文件中复制文件列表,作为新手,我遇到了困难。
这里是一些文本文件。真正的文件没有多余的行,但我必须这样做:
"D:\Shared\Customer Care\Customer Care Common\Customers Contracted\Customers Contracted\Fred 44705"
"D:\Shared\Customer Care\Customer Care Common\Customers Contracted\Customers Contracted\Johnson 47227"
"D:\Shared\Customer Care\Customer Care Common\Customers Contracted\Customers Contracted\Daniel 35434"
"D:\Shared\Customer Care\Customer Care Common\Customers Contracted\Customers Contracted\Frank, John 48273"
我也尝试用双引号将文件名字符串括起来。
这是我尝试使用的简单脚本:
Get-Content c:\users\scripts\files-to-fix.txt | Foreach-Object {copy-item $_ d:\junk}
我得到的错误是:
复制项:找不到驱动器。名为“D”的驱动器不会 存在。在 C:\users\mhyman\scripts\copyfiles.ps1:2 char:81 + 获取内容 c:\users\mhyman\scripts\files-to-fix.txt | Foreach 对象 {复制项
我知道这很简单,但我非常感谢一些帮助。
【问题讨论】:
标签: powershell