如果BAT文件通过计划任务调用,则无法将文件复制到UNC目的地 [英] Can't copy files to UNC Destinations if BAT file is called via scheduled task

查看:784
本文介绍了如果BAT文件通过计划任务调用,则无法将文件复制到UNC目的地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bat文件将文件从当前机器复制到映射网络驱动器(一行,xcopy命令)。

I have a bat file copying files from current machine to mapped network drive (one line, xcopy command).

它在我RDP到服务器时工作。但是,当我作为一个计划任务运行,并配置它在同一用户下运行我登录,它不工作,给出错误0x4。

It works when I RDP to server. However, when I run as a scheduled task, and configure it to run under the same user I'm logged in, it doesn't work and give error 0x4.

有没有办法可以达到这个目的?

Is there a way I can achieve this?

我也尝试dsynchronize,它工作时,我点击同步。当我运行它作为服务同一问题。

I also try dsynchronize and it works when I click synchronized. When I run it as service same issue.

推荐答案

我能够计算出来。以下批处理文件在调度程序下工作,即使作为本地系统帐户:

I was able to figure it out. Following batch files works under scheduler, even as local system account:

net use m: \\server\share /U:server\user password
xcopy C:\source m: /E /Y

它每次映射一个网络驱动器,然后复制到该驱动器

It maps a network drive every time and then copy to that drive

这篇关于如果BAT文件通过计划任务调用,则无法将文件复制到UNC目的地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆