Bat file - Net use from remote desktop not work well in some cases

ぐ巨炮叔叔 提交于 2020-01-07 04:16:13

问题


I try to run .bat file from remote desktop.

I do it by run the next command:

net use m: \\the-ip-of-the-remote-computer mypassword /myuser
// Execution works well

then, I try to xcopy from the remote desktop to my computer. So I write this:

net use t: \\the-ip-of-the-remote-desktop mypassword /myuser
xcopy \\the-ip-of-the-remote-computer my-libary

But in some cases, this command is not execute well.

I also try this, and it doesn't work:

net use m: \\the-ip-of-the-remote-desktop mypassword /myuser
xcopy net use t: \\the-ip-of-the-remote-computer mypassword /myuser my-libary

and It also doesn't work.

What can be the problem.


回答1:


Try mapping the share, then change to that drive before using xcopy

net use M: \\the-ip-of-the-remote-computer mypassword /myuser
pushd M:\
xcopy folder\filetocopy C:\yourcdrivefolder


来源:https://stackoverflow.com/questions/13875950/bat-file-net-use-from-remote-desktop-not-work-well-in-some-cases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!