I am creating a task that executes a batch file for ftp uploads.
The batch script just renames any file in a certain folder to an appropriate name, then uploads that folder.
I have set the task to run under a service account, when I log in with the service account and run the .bat file it works perfectly. When I run the task scheduler it runs the .bat file but the log shows that the ren command doesn't work.
Here is the output from the log after being invoked via task scheduler:
c:\TEMP\Bulletin>rename "R:\x\x\x\*.pdf" Bulletin.pdf
c:\TEMP\Bulletin>chdir c:\Program Files (x86)\WinSCP
c:\Program Files (x86)\WinSCP>WinSCP.com /ini=nul /script=c:\TEMP\Bulletin\bulletin.tmp
Searching for host...
Connecting to host...
Authenticating...
Using username "svc-bulletin".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] [email protected]
File or folder 'C:\FileShares\Drive-R\x\x\x\Bulletin.pdf' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
c:\Program Files (x86)\WinSCP>exit
Here is the output from just manually invoking the .bat file:
C:\TEMP\Bulletin>rename "R:\x\x\x\*.pdf" Bulletin.pdf
C:\TEMP\Bulletin>chdir c:\Program Files (x86)\WinSCP
c:\Program Files (x86)\WinSCP>WinSCP.com /ini=nul /script=c:\TEMP\Bulletin\bulletin.tmp
Searching for host...
Connecting to host...
Authenticating...
Using username "svc-bulletin".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] [email protected]
C:\FileShares\Drive-R\x\x\x\Bulletin.pdf | 957 KB | 1390.5 KB/s | binary | 100%
c:\Program Files (x86)\WinSCP>exit
I am running the task with full permissions and have also tried starting it in the same directory as the .bat and without, neither works. Appreciate any pointers/ideas.