Call WinSCP Saved Session

Advertisement

tee1
Joined:
Posts:
2
Location:
Everywhere

Call WinSCP Saved Session

Is there a way to call the WinSSP saved session and not have WinSCP launch in the foreground. I have a PowerShell script that currently makes a SFTP call to a site; however, I'm needing to use a proxy now. So, I thought that the easiest way would be to create a session in WinSCP then call that saved session from my script. My call line is a
Start-Process -FilePath "C:\Program Files...\..\WinSCP.exe" -ArgumentList "SiteName" -Wait -NoWindow
What this does is launch the WinSCP GUI, logged me into the site, and then stopped. Is there a command switch to run a batch file? My previous process was running psftp and I had the command line arguments for the batch file. Can WinSCP take parameters to run a batch file?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,552
Location:
Prague, Czechia

Re: Call WinSCP Saved Session

Yes, see:
https://winscp.net/eng/docs/commandline#scripting
https://winscp.net/eng/docs/guide_automation

Though, it's not recommended to rely on GUI configuration:
https://winscp.net/eng/docs/scripting#configuration

You can have WinSCP GUI generate a full script for you:
https://winscp.net/eng/docs/ui_generateurl#script

Though in PowerShell, it's better to use WinSCP .NET assembly:
https://winscp.net/eng/docs/library_powershell
https://winscp.net/eng/docs/ui_generateurl#code

Reply with quote

Advertisement

You can post new topics in this forum