0

I have a simple batch file which needs to be run weekly to upload some files via Core FTP.

I'm using the free version of Core FTP LE.

MySavedProfile is the Site Name of the saved profile I created using Core FTP's site Manager. The profile contains the URL / credentials / etc of the site to connect to.

Here are the contents of the batch file:

  SET logf=confirm.log
  echo test-start >> %logf%
  "C:\Progra~1\CoreFTP\coreftp.exe" -B -s -pasv -O -site MySavedProfile -u "C:\Progra~2\PathToFiles\FileToUpload.txt"
  echo test-finish >> %logf%

For the Windows Server 2012 r2 Task Scheduler, I have created a basic, weekly scheduled task on the Task Scheduler Library root which runs the batch file. For this scheduled task I have:

(Under the General tab)

   "Run whether user is logged on or not" is selected
   "Run with highest privileges" is checked
    Configure for = Windows Server 2012 R2

(Under Actions)

   Action = Start a program
   Program / Script = "C:\Progra~2\PathToFiles\batch.bat"
   Start in = C:\Progra~2\PathToFiles\

Here is the weird behavior I am getting:

If I double click on the batch file directly, it works fine and uploads the text file via Core FTP just fine.

However, if I try to let the Windows Task Scheduler run it, it runs everything except the Core FTP line. That is, I get the usual:

 test-start
 test-finish

in the confirm.log file, but the FileToUpload.txt has not been uploaded to the remote server, and there are no errors from CoreFTP that I can detect.

I have tried this with a service account that has permissions to run batch files, as well as my own account for this scheduled task. I get the same result: it doesn't seem to run that CoreFTP line. At least not via Task Scheduler. I need this upload to be automated.

I've searched Core FTP's documentation, Google, etc. No one seems to have run into this exact issue. I've applied recommendations from distantly related issues, but none of them have worked.

Any help would be greatly appreciated. Thank you.

Kira
  • 1
  • 1
  • 1
    Try "Run only when user is logged on" specifying user's account password. – user3806621 Aug 19 '14 at 01:39
  • And I suggest to define log file with complete path like `SET "logf=Full\Path To\confirm.log"` as otherwise the successful creation of the log file depends on current working directory which is most likely different on running as scheduled task. The directory for log file must allow creation of files for any user. – Mofi Aug 19 '14 at 06:05
  • Just did both. The "Run only when user is logged on" works for my account. But in the long run, it can't be my account. And I won't always be logged onto the server for each run. Is there another way to force it to run without needing an account to be currently logged on? Thanks for your help! – Kira Aug 19 '14 at 21:28

1 Answers1

0

The only way to do this is to use the full version of Core FTP (that is Core FTP Pro). If you use the LE version you have to check the "Run only when user is logged on" option.

This happens because of the splash screen at the beginning.

If you can't be logged on forever you could create a user that will always be logged on just for these tasks.

Remember to use the -Log option on CoreFTP to check if it is actually doing something.

c-chavez
  • 7,237
  • 5
  • 35
  • 49