使用任务计划程序找不到文件 [英] File not found using Task Scheduler
问题描述
在我的 C#代码中,我使用XmlDocument引用了XML文件"file.xml" ,该文件与可执行文件本身位于同一目录中.
In my C# code, I reference to an XML file "file.xml", which is in the same directory as the executable itself, using XmlDocument.
该应用程序在VS中运行得很好,但是当我尝试使用Task Scheduler运行该应用程序时,即使一切都相同,我也会得到一个 System.IO.FileNotFoundException
.
The application runs perfectly well in VS, but when I try to run the application using Task Scheduler, I get a System.IO.FileNotFoundException
, even though everything's the same.
我使用 @.\ file.xml"
引用文件.这是Task Scheduler特有的一些怪异东西吗?使用了适当的权限.
I reference to the file using @".\file.xml"
. Is this some weird stuff specific to Task Scheduler? Appropriate permissions are used.
推荐答案
尝试设置任务的启动目录.您可以在任务计划程序"中进行设置.
Try to set startup directory for the task. You can set in Task Scheduler.
选择任务->右键单击->属性->动作标签->选择操作->编辑->开始于(可选)
这篇关于使用任务计划程序找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!