
Hi,
1.Is the file path containing a mapped network drive?
If so, please try to replace by "\server\share\folder\filename.ext" instead of the mapped drive.
2.Here is a similar case when running scripts via windows task scheduler and the resolution shared is to add "cd customized drive" into the script since Task scheduler loads the C:\Windows by default as a directory.
Details could be referred to:
https://stackoverflow.com/questions/44525840/windows-task-scheduler-failed-to-open-stream-no-such-file-or-directory
Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
Hope this helps and please help to accept as Answer if the response is useful.
Thanks,
Jenny