Automation getting The directory name is invalid when running as a Scheduled Task

I have an automation that runs fine from within Toad Data Point 5.0, but gives an error when running as a Scheduled Task. The automation is running a .bat file to check for the existence of a file (the file currently does not exist in the directory), if the file exists it processes the file and then moves it to an archive directory; if the file does not exist it errors with a return code of 2 and logs a message that the file does not exist.

Here is the log file when I run the automation from within Toad Data Point 5.0:

I get the message that the file does not exist as expected.

Here is the log file when I run the automation as a Scheduled Task:

When it tries to run the .bat file it errors with The directory name is invalid.

I am running Toad Data Point 5.0 on Microsoft Windows Server 2019 Standard.
The .bat file is on a mapped drive (Z:) to a MS Azure File Share.

I am sure that there is probably something very simple that I am missing, but I have tried everything I can think of. Any help would be greatly appreciated!!

My guess is that you may have to enclose the dir path in quotes on the other server... See if you can get the batch file to execute successfully first on the other server, then try to have it called within the TDP automation flow.

Enclosing the dir path in quotes (tried both double and single quotes) did not help. There is no "other server", it is all running on the same server. Thanks for the suggestion.

OK, sorry... sounded like either the automation or the batch file was running on another server. Not sure then what's going on... can you place an ECHO in your batch file so you can see exactly what directory is being considered as "invalid"?

I think I figured it out. I had to move the .bat file to a physical drive for it to be seen. Thanks for your suggestions.