Differences
This shows you the differences between the selected revisions of the page.
| guide_protecting_credentials_for_automation 2024-01-27 | guide_protecting_credentials_for_automation 2026-06-03 (current) | ||
| Line 13: | Line 13: | ||
| In [[scripting|script]], you can replace actual credentials with reference to environment variables. You can then call WinSCP from a batch file that sets these variables. The batch file itself then serves as a "configuration file". | In [[scripting|script]], you can replace actual credentials with reference to environment variables. You can then call WinSCP from a batch file that sets these variables. The batch file itself then serves as a "configuration file". | ||
| - | For example, the following script (''example.txt'')((Using [[scriptcommand_open#username|''-username'']] and [[scriptcommand_open#password|''-password'']] switches instead of specifying credentials in [[session_url|session URL]], because the switches do not require the values to be [[session_url#special|URL-encoded]].)): | + | For example, the following script (''example.txt'')((Using [[scriptcommand_open#username|''-username'']] and [[scriptcommand_open#password|''-password'']] ==switches== instead of specifying credentials in [[session_url|session URL]], because the switches do not require the values to be [[session_url#special|URL-encoded]].)): |
| <code winscp> | <code winscp> | ||
| - | open -username=%naim% -password=%MYPASSWORD% sftp://example.com/ | + | open -username=%USERNAME% -password=%PASSWORD% sftp://example.com/ |
| ... | ... | ||
| </code> | </code> | ||
| Line 29: | Line 29: | ||
| </code> | </code> | ||
| ---- | ---- | ||
| - | Another way is to store the password to a separate file and use ''-passwordsfromfiles'': | + | Another way is to store the password to a separate file and use [[scriptcommand_open#passwordsfromfiles|''-passwordsfromfiles'']]: |
| <code winscp> | <code winscp> | ||
| open -password=C:\path\password.txt -passwordsfromfiles sftp://username@example.com/ | open -password=C:\path\password.txt -passwordsfromfiles sftp://username@example.com/ | ||