Differences

This shows you the differences between the selected revisions of the page.

2020-12-24 2022-10-21 (current)
automatically using target article title for link anchor (martin) link update (martin)
Line 10: Line 10:
Use language of your preference. If you have no preference or do not know any scripting language, the easiest may be to use scripting engines available in Windows: Use language of your preference. If you have no preference or do not know any scripting language, the easiest may be to use scripting engines available in Windows:
  * Windows command interpreter (''cmd.exe'') to run ''.bat'' or ''.cmd'' files (for simple tasks);   * Windows command interpreter (''cmd.exe'') to run ''.bat'' or ''.cmd'' files (for simple tasks);
-  * Windows script host (''[[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'' or ''[[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/wscript|wscript.exe]]'') to run Java Script or VB Script files.+  * Windows script host (''[[https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'' or ''[[https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wscript|wscript.exe]]'') to run Java Script or VB Script files.
===== [[batch_file]] Windows command interpreter (batch files) ===== ===== [[batch_file]] Windows command interpreter (batch files) =====
Line 26: Line 26:
It supports all the features listed in Windows command interpreter section above (with greater flexibility). Plus it includes many advanced functions, you may find useful when using together with WinSCP. See sections below. It supports all the features listed in Windows command interpreter section above (with greater flexibility). Plus it includes many advanced functions, you may find useful when using together with WinSCP. See sections below.
-To use the examples below copy the JScript code to file (e.g. ''example.js'') and use ''[[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'' to execute it (use ''/nologo'' to suppress banner):+To use the examples below copy the JScript code to file (e.g. ''example.js'') and use ''[[https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'' to execute it (use ''/nologo'' to suppress banner):
<code batch> <code batch>
cscript /nologo example.js cscript /nologo example.js
Line 32: Line 32:
==== [[inout]] Access to Input/Output streams ==== ==== [[inout]] Access to Input/Output streams ====
-You can use ''[[https://docs.microsoft.com/en-us/previous-versions/aew9yb99(v=vs.85)|WScript.Shell]]'' to execute WinSCP [[executables|console interface tool]] and feed the script commands (using input stream), without creating temporary script file:+You can use ''[[https://learn.microsoft.com/en-us/previous-versions/aew9yb99(v=vs.85)|WScript.Shell]]'' to execute WinSCP [[executables|console interface tool]] and feed the script commands (using input stream), without creating temporary script file:
<code javascript> <code javascript>
var shell = WScript.CreateObject("WScript.Shell"); var shell = WScript.CreateObject("WScript.Shell");
Line 50: Line 50:
==== [[wsh_xml_parsing]] XML parsing ==== ==== [[wsh_xml_parsing]] XML parsing ====
-You can use ''[[https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms756987(v=vs.85)|MSXML2.DOMDocument]]'' object to parse [[logging_xml|XML log]] produced by WinSCP. The following example follows up to the previous one (which starts session with XML logging and lists contents of initial directory):+You can use ''[[https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms756987(v=vs.85)|MSXML2.DOMDocument]]'' object to parse [[logging_xml|XML log]] produced by WinSCP. The following example follows up to the previous one (which starts session with XML logging and lists contents of initial directory):
<code javascript> <code javascript>
// parse XML log file // parse XML log file
Line 95: Line 95:
==== Hidden execution ==== ==== Hidden execution ====
-When executing JScript code with ''[[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'', console window is shown. If you want to execute the JScript without showing console window, use ''[[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/wscript|wscript.exe]]'' instead.+When executing JScript code with ''[[https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cscript|cscript.exe]]'', console window is shown. If you want to execute the JScript without showing console window, use ''[[https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wscript|wscript.exe]]'' instead.
Some notes for using ''wscript'': Some notes for using ''wscript'':

Last modified: by martin