forfiles 不在计划任务中工作
我创建了一个包含以下行的批处理文件:
forfiles /p L:\percepsrvr\SQL /s /m *.bak /d -4 /c "cmd /c del /q @PATH "
这将删除所有超过 3 天的文件,并且在我运行该批处理文件时起作用。
但是,当我尝试将此批处理文件作为计划任务的一部分运行时,该代码行无法执行。我认为这可能是因为映射的网络驱动器(L:),但不确定。
我以自己的身份运行计划任务,以确保它具有与我手动运行它时相同的权限。计划任务在 Win2008r2 服务器盒上运行,L:\ 在 Win2003 SP2 服务器盒上运行。
任何人都知道什么可能会阻止其正常工作或如何调试计划任务?
TIA 布莱恩
I have created a batch file with the following line:
forfiles /p L:\percepsrvr\SQL /s /m *.bak /d -4 /c "cmd /c del /q @PATH "
This deletes any files older than 3 days and works when I run the batch file.
However, when I try to run this batch file as part of a scheduled task the line of code fails to execute. I think it might be because of the mapped network drive (L:) but don't know for sure.
I have the scheduled task running as myself to make sure it has the same permissions as when I run it manually. The scheduled task is running on a Win2008r2 server box and L:\ is on a Win2003 SP2 server box.
Anyone know what might be keeping this from working properly or how to debug a scheduled task?
TIA
Brian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人遇到这篇文章,我找到了如下解决方案:
基本上,将要删除的文件移动到另一个目录,然后删除该目录(可以使用 RoboCopy 完成)。
In case anyone comes across this post I found a solution as follows:
Basically, move the files to delete to another directory and then delete that directory (which can be done with RoboCopy).