create window cmd batch file to automatically retrieving data form SFTP

Advertisement

anthony.nguyen@...
Guest

create window cmd batch file to automatically retrieving data form SFTP

I am trying to create a .bat file which connect to the SFTP site with SSH key and pulling data file once a day.
-------------------------------------------------------------------------------
REM Connect to Concur SFTP

REM SET MyPath=C:\Program Files (x86)\WinSCP\

WinSCP.com sftp://p0092028qn3w@st.concursolutions.com/ -hostkey="myhostkey" -privatekey="C:\Users\xxxxx\Private_key.ppk" -passive = off

get *.pgp
-----------------------------------------------------------------------------
I was able to connect to the SFTP site successfully. However, the script doesn't execute any other command line after it was connected to the site. It opens a command prompt window "winscp>_" and waiting for me to typing the next command line. Then, if I start typing "get *.pgp", then all the files with that extension will be retrieved. How to I bypass the popup command prompt window and force the script to execute rather than manually entering the next command line? This defeat the purpose of automating the task.

I even created 2 separate files (.text and .bat). The .bat files called the .text file, but it still doesn't work. Also,try using winscp.exe with open command, but no luck.

Thanks...

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum