Differences
This shows you the differences between the selected revisions of the page.
| 2013-05-20 | 2013-05-20 | ||
| space after write-host (martin) | streamlining jscript examples (martin) | ||
| Line 34: | Line 34: | ||
| <code javascript> | <code javascript> | ||
| // Local path to download to (keep trailing slash) | // Local path to download to (keep trailing slash) | ||
| - | var LOCALPATH = ".\\"; | + | var LOCALPATH = "c:\\downloaded\\"; |
| // Remote path to download from (keep trailing slash) | // Remote path to download from (keep trailing slash) | ||
| - | var REMOTEPATH = "/"; | + | var REMOTEPATH = "/home/user/"; |
| // File to download | // File to download | ||
| - | var FILE = "winscp421.exe"; | + | var FILE = "download.txt"; |
| // Session to connect to | // Session to connect to | ||
| - | var SESSION = "test@127.0.0.1"; | + | var SESSION = "session"; |
| // Path to winscp.com | // Path to winscp.com | ||
| var WINSCP = "c:\\program files\\winscp\\winscp.com"; | var WINSCP = "c:\\program files\\winscp\\winscp.com"; | ||
| Line 76: | Line 76: | ||
| "exit\n"); | "exit\n"); | ||
| - | // wait until the script finishes | + | // wait until it finishes and collect its output |
| - | while (exec.Status == 0) | + | var output = exec.StdOut.ReadAll(); |
| - | { | + | // optionally print the output |
| - | WScript.Sleep(100); | + | WScript.Echo(output); |
| - | ···WScript.Echo(exec.StdOut.ReadAll()); | + | |
| - | } | + | |
| </code> | </code> | ||
| Line 123: | Line 121: | ||
| "exit\n"); | "exit\n"); | ||
| - | // wait until the script finishes | + | // wait until it finishes and collect its output |
| - | while (exec.Status == 0) | + | var output = exec.StdOut.ReadAll(); |
| - | { | + | // optionally print the output |
| - | WScript.Sleep(100); | + | WScript.Echo(output); |
| - | ···WScript.Echo(exec.StdOut.ReadAll()); | + | |
| - | } | + | |
| if (exec.ExitCode != 0) | if (exec.ExitCode != 0) | ||
| Line 193: | Line 189: | ||
| "exit\n"); | "exit\n"); | ||
| - | // wait until the script finishes | + | // wait until it finishes and collect its output |
| - | while (!exec.StdOut.AtEndOfStream) | + | var output = exec.StdOut.ReadAll(); |
| - | { | + | // optionally print the output |
| - | ···WScript.Echo(exec.StdOut.ReadAll()); | + | WScript.Echo(output); |
| - | } | + | |
| if (exec.ExitCode != 0) | if (exec.ExitCode != 0) | ||
| Line 263: | Line 258: | ||
| "exit\n"); | "exit\n"); | ||
| - | // wait until the script finishes | + | // wait until it finishes and collect its output |
| - | while (exec.Status == 0) | + | var output = exec.StdOut.ReadAll(); |
| - | { | + | // optionally print the output |
| - | WScript.Sleep(100); | + | WScript.Echo(output); |
| - | ···WScript.Echo(exec.StdOut.ReadAll()); | + | |
| - | } | + | |
| if (exec.ExitCode != 0) | if (exec.ExitCode != 0) | ||