commandline » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
2014-08-04 | 2014-08-27 | ||
password in all open examples (martin) | batch file syntax highlighting (martin) | ||
Line 3: | Line 3: | ||
===== Parameters ===== | ===== Parameters ===== | ||
Parameters for ''[[executables|winscp.exe]]'' executable: | Parameters for ''[[executables|winscp.exe]]'' executable: | ||
- | <code> | + | <code batch> |
winscp.exe site|workspace|folder | winscp.exe site|workspace|folder | ||
winscp.exe <session_url>[/path/[file]] | winscp.exe <session_url>[/path/[file]] | ||
Line 22: | Line 22: | ||
Parameters for ''[[executables|winscp.com]]'' executable: | Parameters for ''[[executables|winscp.com]]'' executable: | ||
- | <code> | + | <code batch> |
winscp.com [/script=script_file] [/command command1 command2 ...] [/parameter param1 ...] | winscp.com [/script=script_file] [/command command1 command2 ...] [/parameter param1 ...] | ||
winscp.com [/ini=<inifile>] [/log=<logfile>] [/xmllog=<logfile> [/xmlgroups]] [/nointeractiveinput] | winscp.com [/ini=<inifile>] [/log=<logfile>] [/xmllog=<logfile> [/xmlgroups]] [/nointeractiveinput] | ||
Line 51: | Line 51: | ||
When using [[scripting]], use ''[[scriptcommand_open|open]]'' command (and its switches) instead. This allows you settings [[scriptcommand_option|script options]] before starting session. | When using [[scripting]], use ''[[scriptcommand_open|open]]'' command (and its switches) instead. This allows you settings [[scriptcommand_option|script options]] before starting session. | ||
- | <code> | + | <code batch> |
winscp.exe "My site" | winscp.exe "My site" | ||
winscp.exe sftp://martin:password@example.com/ /hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | winscp.exe sftp://martin:password@example.com/ /hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | ||
Line 62: | Line 62: | ||
With ''/log'' parameter you may turn on [[logging|session logging]] to file specified by [[local_path|local path]]. With ''/xmllog'' parameter you may turn on [[logging_xml|XML logging]] to file specified by local path. ((For backward compatibility, XML logging can also be enabled using ''/log'' parameter with filename ending with ''.xml'' extension.)) In either path you can use the same patterns as in the [[ui_pref_logging|logging preferences]]. | With ''/log'' parameter you may turn on [[logging|session logging]] to file specified by [[local_path|local path]]. With ''/xmllog'' parameter you may turn on [[logging_xml|XML logging]] to file specified by local path. ((For backward compatibility, XML logging can also be enabled using ''/log'' parameter with filename ending with ''.xml'' extension.)) In either path you can use the same patterns as in the [[ui_pref_logging|logging preferences]]. | ||
- | <code> | + | <code batch> |
winscp.exe sftp://martin@example.com/ /log="C:\winscp.log" | winscp.exe sftp://martin@example.com/ /log="C:\winscp.log" | ||
</code> | </code> | ||
Line 81: | Line 81: | ||
Use parameter ''/nointeractiveinput'', when feeding commands to ''[[executables|winscp.com]]'' using [[executables#redirection|standard input]], to make sure prompts for anything other than commands (such as password prompts) are cancelled. | Use parameter ''/nointeractiveinput'', when feeding commands to ''[[executables|winscp.com]]'' using [[executables#redirection|standard input]], to make sure prompts for anything other than commands (such as password prompts) are cancelled. | ||
- | <code> | + | <code batch> |
winscp.com /script="C:\Users\martin\Documents\myscript.txt" | winscp.com /script="C:\Users\martin\Documents\myscript.txt" | ||
winscp.com /command "option batch abort" "option confirm off" "open sftp://martin@example.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx...""" "exit" | winscp.com /command "option batch abort" "option confirm off" "open sftp://martin@example.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx...""" "exit" | ||
Line 100: | Line 100: | ||
It is recommended to escape the arguments with [[commandline#syntax|// switch]]. | It is recommended to escape the arguments with [[commandline#syntax|// switch]]. | ||
- | <code> | + | <code batch> |
winscp.exe /defaults /synchronize // "C:\Users\martin\Documents\MySite" /home/martin/public_html | winscp.exe /defaults /synchronize // "C:\Users\martin\Documents\MySite" /home/martin/public_html | ||
</code> | </code> | ||
Line 107: | Line 107: | ||
With ''/ini'' parameter you may specify [[local_path|local path]] to [[config|configuration INI file]]. It effectively disables using [[config|registry as configuration storage]]. If the file does not exist, default configuration will be used and the file will be created. | With ''/ini'' parameter you may specify [[local_path|local path]] to [[config|configuration INI file]]. It effectively disables using [[config|registry as configuration storage]]. If the file does not exist, default configuration will be used and the file will be created. | ||
- | <code> | + | <code batch> |
winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini" | winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini" | ||
</code> | </code> | ||
Line 120: | Line 120: | ||
===== [[syntax]] Syntax ===== | ===== [[syntax]] Syntax ===== | ||
Command-line parameters that include space(s) must be surrounded by double-quotes: | Command-line parameters that include space(s) must be surrounded by double-quotes: | ||
- | <code> | + | <code batch> |
winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini" | winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini" | ||
</code> | </code> | ||
To use the double-quote as a literal, use two double-quotes sequentially. For example, the ''/command'' expects that each script command is surrounded by double quotes, so that it is passed as a single command-line argument. In addition, any script command argument that includes spaces is expected to be surrounded by double-quotes within the command (see [[scripting#syntax|doubling double-quotes]]): | To use the double-quote as a literal, use two double-quotes sequentially. For example, the ''/command'' expects that each script command is surrounded by double quotes, so that it is passed as a single command-line argument. In addition, any script command argument that includes spaces is expected to be surrounded by double-quotes within the command (see [[scripting#syntax|doubling double-quotes]]): | ||
- | <code> | + | <code batch> |
winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat""" | winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat""" | ||
<- script cmd 1 -> <- script cmd 2 -> | <- script cmd 1 -> <- script cmd 2 -> | ||
Line 131: | Line 131: | ||
An argument that begins with a slash is considered a switch. To pass a parameter that itself starts with the slash in its syntax (i.e. a remote path like ''/root''), use the special switch ''%%//%%'' (two slashes) before the argument. The switch ''%%//%%'' denotes that all following arguments are not switches. Example: | An argument that begins with a slash is considered a switch. To pass a parameter that itself starts with the slash in its syntax (i.e. a remote path like ''/root''), use the special switch ''%%//%%'' (two slashes) before the argument. The switch ''%%//%%'' denotes that all following arguments are not switches. Example: | ||
- | <code> | + | <code batch> |
winscp.exe /synchronize // "C:\Users\martin\Documents\MySite" /root | winscp.exe /synchronize // "C:\Users\martin\Documents\MySite" /root | ||
</code> | </code> |