Post a reply

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)


Topic review


Re: Open session with site name in PowerShell script

The /ini=nul instructs WinSCP to ignore any configuration. While you want the opposite. So remote it (although we do not recommend that).

Open session with site name in PowerShell script

I am a bit new to WinSCP. I am trying to automate and write a PowerShell script to open an SFTP site. I have saved the site info in the Site Manager and I am trying to open that session in my script with the open command. For some reason when the script is run it will not find the site that is specified. for example:
# Needed for PowerShell 7.3 and newer
$PSNativeCommandArgumentPassing = "Legacy"
& "C:\Program Files (x86)\WinSCP\" `
  /log="E:\ChromeRiver\LOGS\WinSCP.log" /ini=nul `
  /command `
    "open  ChromeRiverEU" `
    "cd /files/export" `
    "lcd E:\ChromeRiver" `
    "get LNBR-OOP-PROD-YEWD*.xls"

any advice would be great.. Thanks