Search code examples
authenticationsftpwindows-authenticationwinscp

Use Windows password in WinSCP script


Is it possible to automatically use Windows password in WinSCP script? Instead of typing it in script file.

script.txt file consists:

open MyUserName:[email protected]
option transfer binary
get TestFile.txt c:\
close 

winscp.bat that triggers the script contains

winscp.exe /console /script=script.txt

Solution

  • WinSCP (nor any other application) cannot retrieve your password from Windows. It's not possible in general, it would be a security threat.

    Anyway, WinSCP supports Kerberos/GSSAPI/SSPI authentication that allows you to reuse your domain authentication for connection to an SSH/SFTP server. So you may be able to use that, if your SSH/SFTP server supports that.

    open sftp://[email protected] /rawsettings AuthGSSAPI=1
    

    References: