Differences

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

2009-03-05 2009-04-17
4.2 bug 95 logging_xml with .xml (martin) reorganize (sections) (martin)
Line 1: Line 1:
====== Command-line Options ====== ====== Command-line Options ======
-If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to [[integration#search_path|search path]]. 
 +===== Parameters =====
<code> <code>
winscp.exe stored_session winscp.exe stored_session
Line 15: Line 15:
</code> </code>
-The first syntax opens the stored session (to open session, stored in folder, use path syntax "folder/session"). The second creates the session specified by at least hostname, optionally by name of protocol, port number, username, password and initial remote path. If the remote path is not ended by slash (''/''), it is treated as path to file (or even directory) that should be downloaded. Special characters (like ''@'' in username) can be encoded using ''%XX'' syntax, where ''XX'' is hexadecimal ASCII code.+==== Session ==== 
 +The first syntax opens the stored session (to open session, stored in folder, use path syntax "folder/session").
 +The second creates the session specified by at least hostname, optionally by name of protocol, port number, username, password and initial remote path. If the remote path is not ended by slash (''/''), it is treated as path to file (or even directory) that should be downloaded. Special characters (like ''@'' in username) can be encoded using ''%XX'' syntax, where ''XX'' is hexadecimal ASCII code.
 +
 +For security reasons, when protocol (''%%sftp://%%'', ''%%ftp://%%'' or ''%%scp://%%'') is provided on command line (possible execution from web browser/Windows Explorer), all command-like parameters that cause any automatic action are ignored, including ''/defaults'', ''/log'', ''/script'' and ''/command''.
 +
 +Parameter ''/privatekey'' specifies [[public_key#private|private key file]]. Parameter ''/hostkey'' specifies fingerprint of expected host key (or several fingerprints separated by semicolon). It makes WinSCP automatically [[ssh#verifying_the_host_key|accept hostkey]] with the fingerprint.
 +
 +When using [[scripting]], use ''[[script_commands#open|open]]'' command (and its switches) instead. This allows you settings [[script_commands#option|script options]] before starting session.
 +
 +With ''/log'' parameter you may turn on [[logging|session logging]] to given file. If the log file name has ''.xml'' extension, [[logging_xml|XML logging]] is used. You can use environment variables in the path, with syntax ''%NAME%''.
 +
 +==== Console/scripting mode ====
Parameter ''/console'' executes WinSCP in [[scripting|console (scripting) mode]]. Note that when WinSCP is executed via [[scripting#console|console interface (winscp.com)]], the ''/console'' parameter is not necessary. Parameter ''/console'' executes WinSCP in [[scripting|console (scripting) mode]]. Note that when WinSCP is executed via [[scripting#console|console interface (winscp.com)]], the ''/console'' parameter is not necessary.
-To run batch script either pass script file using ''/script'' parameter or specify the commands directly on command line using ''/command''. In the latter case each following parameter is treated as single command (If the command includes spaces, enclose it in quotes). If both ''/script'' and ''/command'' parameters are used, commands from script file are executed first. When the last command is not ''exit'', regular non-batch mode follows. If ''/console'' parameter is not used along with ''/script'' or ''/command'', the script/command is executed without visual feedback (window).+To run batch script either pass script file using ''/script'' parameter or specify the commands directly on command line using ''/command''. In the latter case each following parameter is treated as single command (If the command includes spaces, enclose it in quotes).
-With ''/synchronize'' or ''/keepuptodate'' parameter WinSCP performs //Synchronize// or //Keep remote directory up to date// commands respectively on the specified session and directories. A dialog to set options is displayed first (Note that this is not intended for automation, see [[scripting]]).+If both ''/script'' and ''/command'' parameters are used, commands from script file are executed first. When the last command is not ''exit'', regular non-batch mode follows.
-With ''/upload'' parameter WinSCP uploads specified files to remote directory of session defined using one of the previous syntaxes. A dialog to set options is displayed first (Note that this is not intended for automation, see [[scripting]], but to allow [[integration#exporer_s_send_to_context_menu|Windows Explorer's 'Send To' menu]] integration).+If ''/console'' parameter is not used along with ''/script'' or ''/command'', the script/command is executed without visual feedback (window).
-Use ''/defaults'' parameter along with ''/upload'', ''/synchronize'' or ''/keepuptodate'' to skip the settings dialog and start the operation straight away with default settings.+==== Operations ==== 
 +The following parameters can be used to create shortcut that initiated operation in GUI mode. They are not intended for automation, for that see [[scripting]].
-Parameter ''/privatekey'' specifies [[public_key#private|private key file]]. Parameter ''/hostkey'' specifies fingerprint of expected host key (or several fingerprints separated by semicolon). It makes WinSCP automatically [[ssh#verifying_the_host_key|accept hostkey]] with the fingerprint.·+With ''/synchronize'' or ''/keepuptodate'' parameter WinSCP performs //Synchronize// or //Keep remote directory up to date// commands respectively on the specified session and directories. A dialog to set options is displayed first.
-With ''/ini'' parameter you may specify 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. You can use environment variables in the path, with syntax ''%NAME%''.+With ''/upload'' parameter WinSCP uploads specified files to remote directory of session defined using one of the previous syntaxes((Parameter is primarily intended to allow [[integration#exporer_s_send_to_context_menu|Windows Explorer's 'Send To' menu]] integration)). A dialog to set options is displayed first.
-With ''/log'' parameter you may turn on [[logging|session logging]] to given file. If the log file name has ''.xml'' extension, [[logging_xml|XML logging]] is used. You can use environment variables in the path, with syntax ''%NAME%''.+Use ''/defaults'' parameter along with ''/upload'', ''/synchronize'' or ''/keepuptodate'' to skip the settings dialog and start the operation straight away with default settings. 
 + 
 +==== Configuration ==== 
 +With ''/ini'' parameter you may specify 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. You can use environment variables in the path, with syntax ''%NAME%''.
 +==== Auxiliary ====
When run with ''/update'' parameter, WinSCP only checks for its [[updates|updates]]. When run with ''/update'' parameter, WinSCP only checks for its [[updates|updates]].
Parameter ''/help'' shows usage (overview similar to this). Parameter ''/help'' shows usage (overview similar to this).
-For security reasons, when protocol (''%%sftp://%%'', ''%%ftp://%%'' or ''%%scp://%%'') is provided on command line (possible execution from web browser/Windows Explorer), all command-like parameters that cause any automatic action are ignored, including ''/defaults'', ''/log'', ''/script'' and ''/command''.+===== Hint ===== 
 +If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to [[integration#search_path|search path]]. 

Last modified: by martin