Copy data from bloomberg sft with winscp cmd

It is a little bit tricky to run winscp command. Here is a working example:

  1. connect and authenticate with pre shared key
  2. synchronize all except bin,etc
  3. exit with correct exit code
  4. eventually run powershell script
@echo off
"C:\Path\" ^
  /log="C:\Path\WinSCP.log" /ini=nul ^
  /command ^
    "open s -hostkey=""ssh-rsa 2048 AA:BB:CC:DD:EE:FF:AA:BB:CC:DD:EE:FF:00:00:00:00"" -privatekey=""C:\Path\bloomberg.ppk""" ^
    "synchronize -filemask=""|/bin/;/etc/""  local ""SFTP"""^

if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error

powershell -file sync2r.ps1


Leave a Reply

Your email address will not be published. Required fields are marked *