通过批处理脚本从另一台计算机操作文件

Manipulate file from another computer through batch script

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

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

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。

你能帮帮我吗?

为什么你会认为你可以编写命令行得通?

runas /?

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

其他小的调整只是重命名而不是 copy/delete - 大文件会更快。

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

pause