I have a VBScript that does a number of tasks, including moving files from one place to another.
Lots of copy/move/create folder/delete folder/delete files like this
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CopyFile "D:\Test Now\test.txt", "W:\test_2\test.txt"
I’m able to get the entire script to work when I run it manually by double clicking it and no errors come up. However, when I run it from scheduled task an error is shown “Path Not Found”. I found this error by writing this error to a DB.
If
ON ERROR RESUME NEXT
is off the script is stuck in that error. With it set to on, the script would skip the operations not carry out its function.
I’ve quadruple checked the paths to make sure its right. Is there something I should be aware of when running scripts with scheduled tasks?
Are D:\ And W:\ local drives, or are they mapped network drives? If they’re mapped, the user running the process might not have those drives available. Be sure you run the task as a privileged local account. It’s also best to log in to that account and run the command manually. Once you verify that it works, then you can tighten up security if that’s a concern.