【问题标题】:Manipulate file from another computer through batch script通过批处理脚本从另一台计算机操作文件
【发布时间】:2015-04-24 12:28:17
【问题描述】:

我想从我的计算机连接到另一台计算机。 然后我想从这台计算机访问一个文件,复制这个文件并删除它。

这是我的批处理脚本,但它不起作用:

net use X: \\computer2 passwordOfComputer2 /u:computer2\admin
copy "X:\Users\admin\AppData\Roaming\myfile.txt" "X:\Users\admin\AppData\Roaming\myfile.txt.old"
del "X:\Users\admin\AppData\Roaming\myfile.txt"

pause

我遇到系统错误 53。

你能帮帮我吗?

【问题讨论】:

  • 检查工具允许您在远程机器上执行命令的工具 - WMIC PROCESS,WINRS,PSEXEC,xCMD

标签: file batch-file cmd


【解决方案1】:

要找出错误消息 53 是什么,请使用 net helpmsg 53 - 它告诉您 The network path was not found. 原因是您没有指定共享,只指定了计算机名。

其他小的调整只是重命名而不是复制/删除 - 对于大文件来说会更快。

net use X: \\computer2\c$ passwordOfComputer2 /u:computer2\admin
ren "X:\Users\admin\AppData\Roaming\myfile.txt" "myfile.txt.old"

pause

【讨论】:

    【解决方案2】:

    为什么你认为你可以编写命令会起作用?

    runas /?

    【讨论】:

    • 命令有效且未使用 runas - 混淆
    • 因为不需要映射驱动器。您可以直接进行,如果存在安全问题,runas 将克服它。而且命令不正确,为什么要纠正错误的方法。最简单的move "\\computer2\X$\Users\admin\AppData\Roaming\myfile.txt" "\\computer2\x$\Users\admin\AppData\Roaming\myfile.txt.old"
    猜你喜欢
    • 2013-10-30
    • 1970-01-01
    • 1970-01-01
    • 2010-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    相关资源
    最近更新 更多