Re: Generate session URL from command line?
So it seems that you run WinSCP scripting from your PowerShell script, not WinSCP .NET assembly, right?
The only two differences between the two encodings seems to be that
The problem is that your credentials are not encoded only for URL, but also for a batch file, where
https://winscp.net/eng/docs/session_url#special
In PowerShell, you can do that simply by:
But on the other hand, you do not need this
The only two differences between the two encodings seems to be that
Uri.EscapeDataString
encodes also *
, what WinSCP UI does not. That's not an issue.
The problem is that your credentials are not encoded only for URL, but also for a batch file, where
%
has to be doubled to %%
. See:
https://winscp.net/eng/docs/session_url#special
In PowerShell, you can do that simply by:
$url = $url -replace "%", "%%"
But on the other hand, you do not need this
%
encoding in PowerShell. That only for batch files. So I'm bit confused.