[英]C# Win App, Task Scheduler, User Account: System. Microsoft Excel cannot access the file
Microsoft Excel cannot access the file 'D:\Automation\02_14_25_.xlsx' There are several possible reasons:
Microsoft Excel 无法访问文件 'D:\Automation\02_14_25_.xlsx' 有几个可能的原因:
• The file name or path does not exist.• 文件名或路径不存在。 • The file is being used by another program.
• 该文件正被另一个程序使用。 • The workbook you are trying to save has the same name as a currently open workbook.
• 您尝试保存的工作簿与当前打开的工作簿同名。
C:\Windows\SysWOW64\config\systemprofile
and C:\Windows\System32\config\systemprofile\
but still same error.C:\Windows\SysWOW64\config\systemprofile
和C:\Windows\System32\config\systemprofile\
中创建了文件夹 Desktop,但仍然存在相同的错误。You did not clarify that the file: "D:\Automation\02_14_25_.xlsx"您没有说明文件:“D:\Automation\02_14_25_.xlsx”
Actually exists or if that is just the error message you could not correctly interpret.实际存在,或者这只是您无法正确解释的错误消息。
In that case my answer would be: Your application is not started with the correct environment variables if it runs as a scheduled task.在这种情况下,我的回答是:如果您的应用程序作为计划任务运行,则它没有使用正确的环境变量启动。 That is my classical mistake for the:
这是我的经典错误:
"It works when i run it manually but it doesn't when i do it with cron/scheduled task." “当我手动运行它时它可以工作,但当我使用 cron/计划任务时它不起作用。” - Scenario
- 设想
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.