Task Scheduler status still shows as Running after a BAT completes its task

瘦欲@ 提交于 2019-12-13 02:11:45

问题


I'm attempting to create a batch file that I can use with Task Manager in Windows 7 to copy users' local Google Earth file to a network location where it can be backed-up. It appears that the BAT is running just fine, but the task does not complete or stop once it's done & continues to show a status of "running".

Thanks in advanced for the suggestions!

COPY/Y "C:\Users\lena.domain\AppData\LocalLow\Google\GoogleEarth\myplaces.kml" "\\server\u-users\Lena\system backup\Google Earth"  cmd.exe /C

回答1:


Running your single line in a command prompt window results in error message: syntax error

Reason 1: There is no space between command COPY and option /Y.

Reason 2: There is cmd.exe /C appended at end of the line.

Use in your batch file the line:

COPY /Y "C:\Users\lena.domain\AppData\LocalLow\Google\GoogleEarth\myplaces.kml" "\\server\u-users\Lena\system backup\Google Earth"

And additionally make sure that this job is executed from task scheduler with credentials (account) which has the permission to write something on server. The local SYSTEM account often used for scheduled tasks has surely no permissions to access files on the server at all. It looks like the best account to use for this scheduled task is the user account of lena.domain. See also Configure a Scheduled Task Item (At least Windows 7)



来源:https://stackoverflow.com/questions/24434965/task-scheduler-status-still-shows-as-running-after-a-bat-completes-its-task

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