Topic "Using "call cp" stops executing of other commands"

Author Message
Warsawman
[View user's profile]

Joined: 2017-07-06
Posts: 1
Location: Poland
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:
Code:
@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
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27083
Location: Prague, Czechia
You are missing ^ at the end of the call cp line:

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

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License