Reputation: 1
I have Task Scheduler on a Windows server; the User Account is System. This task starts a .NET windows app that reads an Excel file, but it shows the error:
Microsoft Excel cannot access the file 'D:\Automation\02_14_25_.xlsx' There are several possible reasons:
- 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.
I created the folder Desktop in C:\Windows\SysWOW64\config\systemprofile
and C:\Windows\System32\config\systemprofile\
but still same error.
When I log in to the server as myself(administrator) and run the app, it runs without errors.
Any suggestions please?
Upvotes: 0
Views: 345
Reputation: 51
You did not clarify that the file: "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." - Scenario
Upvotes: 3