Differences
This shows you the differences between the selected revisions of the page.
2017-10-04 | 2017-10-04 | ||
using variable expansion in strings in powershell (martin) | code wrapping for new design (martin) | ||
Line 66: | Line 66: | ||
UserName = "user", | UserName = "user", | ||
Password = "mypassword", | Password = "mypassword", | ||
- | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
}; | }; | ||
Line 79: | Line 79: | ||
TransferOperationResult transferResult; | TransferOperationResult transferResult; | ||
- | transferResult = session.GetFiles("/home/user/*", "d:\\download\\", false, transferOptions); | + | transferResult = |
+ | ···················session.GetFiles("/home/user/*", "d:\\download\\", false, transferOptions); | ||
// Throw on any error | // Throw on any error | ||
Line 118: | Line 119: | ||
.UserName = "user" | .UserName = "user" | ||
.Password = "mypassword" | .Password = "mypassword" | ||
- | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
End With | End With | ||
Line 130: | Line 131: | ||
Dim transferResult As TransferOperationResult | Dim transferResult As TransferOperationResult | ||
- | transferResult = session.GetFiles("/home/user/*", "d:\download\", False, transferOptions) | + | transferResult = |
+ | ···················session.GetFiles("/home/user/*", "d:\download\", False, transferOptions) | ||
' Throw on any error | ' Throw on any error | ||
Line 167: | Line 169: | ||
UserName = "user" | UserName = "user" | ||
Password = "mypassword" | Password = "mypassword" | ||
- | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
} | } | ||
Line 181: | Line 183: | ||
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary | $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary | ||
- | $transferResult = $session.GetFiles("/home/user/*", "d:\download\", $False, $transferOptions) | + | $transferResult = |
+ | ···········$session.GetFiles("/home/user/*", "d:\download\", $False, $transferOptions) | ||
# Throw on any error | # Throw on any error | ||
Line 223: | Line 226: | ||
sessionOptions.UserName = "user"; | sessionOptions.UserName = "user"; | ||
sessionOptions.Password = "mypassword"; | sessionOptions.Password = "mypassword"; | ||
- | sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"; | + | sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."; |
var session = WScript.CreateObject("WinSCP.Session"); | var session = WScript.CreateObject("WinSCP.Session"); | ||
Line 236: | Line 239: | ||
transferOptions.TransferMode = TransferMode_Binary; | transferOptions.TransferMode = TransferMode_Binary; | ||
- | var transferResult = session.GetFiles("/home/user/*", "d:\\download\\", false, transferOptions); | + | var transferResult = |
+ | ···········session.GetFiles("/home/user/*", "d:\\download\\", false, transferOptions); | ||
// Throw on any error | // Throw on any error | ||
Line 242: | Line 246: | ||
// Print results | // Print results | ||
- | for (var enumerator = new Enumerator(transferResult.Transfers); !enumerator.atEnd(); enumerator.moveNext()) | + | for (var enumerator = new Enumerator(transferResult.Transfers); |
+ | ··················!enumerator.atEnd(); enumerator.moveNext()) | ||
{ | { | ||
WScript.Echo("Download of " + enumerator.item().FileName + " succeeded"); | WScript.Echo("Download of " + enumerator.item().FileName + " succeeded"); | ||
Line 282: | Line 287: | ||
.UserName = "user" | .UserName = "user" | ||
.Password = "mypassword" | .Password = "mypassword" | ||
- | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
End With | End With | ||