Using "call cp" stops executing of other commands

Advertisement

Warsawman
Joined:
Posts:
1
Location:
Poland

Using "call cp" stops executing of other commands

I'm trying to and then upload a new one.
I'm using "call cp ..." for backup since I don't find any native winscp command for copying a file.
The problem is after that call the program turns into "winscp>" mode and the rest of the commands don't execute.
I need to input "exit" manually to exit this state but the rest of winscp commands still won't execute.
How can I make the script work in a whole?

My batch code is:
@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\php\_WinSCP.log" /ini=nul ^
  /command ^
    "open (...)" ^
    "call cp /path/thefile.txt /path2/thefile%dzisiaj%.txt"
    "cd /media/baza/data/ordynator" ^
    "lcd C:\Users\jzbudniewek\Documents\produkcja\" ^
    "put thefile.txt" ^
    "exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
pause

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,390
Location:
Prague, Czechia

Re: Using "call cp" stops executing of other commands

You are missing ^ at the end of the call cp line:

"call cp /path/thefile.txt /path2/thefile%dzisiaj%.txt" ^

Reply with quote

Advertisement

You can post new topics in this forum