首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法将文件复制到“测试路径”可以看到的路径。

无法将文件复制到“测试路径”可以看到的路径。
EN

Stack Overflow用户
提问于 2014-03-31 18:38:07
回答 1查看 429关注 0票数 1

这是我到目前为止所拥有的。我明白

复制项目:路径中的非法字符。

我试图在每个工作站上创建一个目录(`89),将工作站上的现有文件复制到该文件夹,然后将新文件复制到指定的路径。当我注释掉与复制有关的所有内容并验证路径时,路径返回为有效。

我尝试使用批处理文件通过SCCM (2007)中的s/w推送来部署这些文件,但由于Trnsport之间的路径未找到/无效路径错误,以及Trns(称为中间点)的路径失败。

代码语言:javascript
复制
$file = "\\path\to\files\ITClientBuild\Specs2\specslas5\testcopy.txt"
$outfile = "c:\temp\las6copy.csv"
gc c:\temp\las6.txt | %{
    $computer = $_
    $ping = Test-Connection $computer -Count 2 -Quiet
    if ($ping) {
        $pathTest1 = Test-Path "\\$computer\c$\Program Files\AASHTOWare\Trns·port Client-Server   PES-LAS"
        $pathTest2 = Test-Path "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port Client-Server PES-LAS"
        if($pathTest1 -eq $true){
            # md -Force "\\$computer\c$\windows\temp\las5a"
            # cp -force "\\$computer\c$\Program Files\AASHTOWare\Trns·port Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*"
            cp -force $file "\\$computer\\c$\\Program Files\\AASHTOWare\\Trns·port Client-Server PES-LAS\\*"

            "$computer  FILE PUSHED to PES-LAS dir" >> $outfile
        } else {
            "$computer  las6 PATH DOES NOT EXIST!!" >> $outfile
        }
        if ($pathTest2 -eq $true){
            # md -Force "\\$computer\c$\windows\temp\las5a"
            # cp -force "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*"
            cp -force $file "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port Client-Server PES-LAS\*"

            "$computer  FILE PUSHED to PES-LAS dir" >> $outfile
        } else {
            "$computer  PES-LAS PATH DOES NOT EXIST!!" >> $outfile
        }
    } else {
        "$computer  OFFLINE" >> $outfile
    }
}
EN

回答 1

Stack Overflow用户

发布于 2014-03-31 19:11:08

发生此错误是因为您的目的地不应该包含\*。不要去尝试它,它应该没有问题地完成。

代码语言:javascript
复制
cp -force $file "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port Client-Server PES-LAS"
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22769533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档