Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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" ^
Warsawman

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