0

I want to schedule a task that for each file in a specific local directory deletes a file with the same name on a remote server's directory.

On the command I run this

for  %f in (*) do start winscp /command "open ftp://user:password@mythost.com/"   "rm %f" "close" "exit"

and it works

but when I run it as a scheduled task and starting the cmd.exe program and passing in the following argument for %f in (*) do start winscp /command "open ftp://user:pass@host.com/" "rm %f" "close" "exit" it doesnt work

what is my problem?

Meir
  • 163

1 Answers1

0

You need to add "/c" at the beginning of the arguments:

/c for  %f in (*) do start winscp  /command "open ftp://user:pass@host.com/"   "rm %f" "close" "exit"

So the complete command would become as follows:

cmd.exe /c for  %f in (*) do start winscp  /command "open ftp://user:pass@host.com/"   "rm %f" "close" "exit"

For more details, see also this thread: https://stackoverflow.com/a/5047185/5538923 .

marcor92
  • 116