Differences

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

remote_command 2012-09-04 remote_command 2023-02-22 (current)
Line 1: Line 1:
====== Remote Commands ====== ====== Remote Commands ======
-WinSCP offers unique feature to execute command on remote server as with regular terminal client. However as it cannot implement the terminal fully, there are some limitations. Particularly, you cannot execute commands that require terminal emulation or user input. See [[remote_command#limitations|below]] for technical details.+WinSCP offers a unique feature to execute commands on a remote server as with a regular terminal client. However as it cannot implement the terminal fully, there are some limitations. Particularly, you cannot execute commands that require terminal emulation or user input. See [[#limitations|below]] for technical details.
-Basically the feature is supported only for [[scp|SCP protocol]]. With [[SFTP]] you can still use the feature by opening [[shell_session|separate shell session]], which in fact takes place automatically for you. With [[FTP]] you can only execute FTP protocol commands. However some FTP servers have a command allowing execution of remote command, e.g. ''site exec <command>''.+Basically, the feature is supported only for [[scp|SCP protocol]]. With [[SFTP]] you can still use the feature by opening [[shell_session|separate shell session]], which in fact takes place automatically for you. With [[FTP]] you can only execute FTP protocol commands. However, some FTP servers have a command allowing execution of remote commands, e.g. ''SITE EXEC <command>''. [[WebDAV]] and [[S3]] protocols do not allow executing remote commands.
===== How to Enter the Remote Command ===== ===== How to Enter the Remote Command =====
You can enter the command on [[ui_console|Console window]] (//Commands > Open Terminal//). You can enter the command on [[ui_console|Console window]] (//Commands > Open Terminal//).
-If you are using Commander interface you can also enter the command on [[ui_commander#command_line|command-line box]] below the panels.+If you are using the Commander interface you can also enter the command on [[ui_commander#command_line|command-line box]] below the panels.
-If you want to have full featured terminal, you may find command //[[integration_app#opening_current_session_in_putty|Open In PuTTY]]// useful.+If you want to have full featured terminal, you may find command //[[integration_putty#open_putty|Open in PuTTY]]// useful.
===== Automating Command Execution ===== ===== Automating Command Execution =====
Line 15: Line 15:
===== Custom Commands ===== ===== Custom Commands =====
-If there is command you need to execute regularly and in particular if the command works with files, you can find [[custom_command|custom commands]] useful.+If there is a command you need to execute regularly and in particular if the command works with files, you can find [[custom_command|custom commands]] useful.
===== [[limitations]] Technical Background of Terminal Limitations ===== ===== [[limitations]] Technical Background of Terminal Limitations =====
WinSCP does not support commands that require terminal emulation or user input. WinSCP does not support commands that require terminal emulation or user input.
-Terminal emulation cannot be implemented at all as it is not possible to combine terminal emulation and file transfers in the same session. The reason is that with terminal emulation control characters have special meaning that is interpreted by the server. On the other hand the same characters (bytes) have special meaning in the file transfer protocols or may be simply present in the (binary) files being transferred.+Terminal emulation cannot be implemented at all as it is not possible to combine terminal emulation and file transfers in the same session. The reason is that with terminal emulation control characters have a special meaning that is interpreted by the server. On the other hand, the same characters (bytes) have special meaning in the file transfer protocols or may simply be present in the (binary) files being transferred.
-If you happen to try execute command requiring terminal emulation, it will typically refuse to run with error message like "Error opening terminal", "No TTY available", "stdin: is not a tty" or "Couldn't open /dev/tty for reading". +If you happen to try to execute a command requiring terminal emulation, it will typically refuse to run with an error message like "Error opening terminal", "No TTY available", "stdin: is not a tty" or "Couldn't open /dev/tty for reading".
- +
-WinSCP may possibly support user input. However most commands requiring user input does that via terminal emulation features. If your command needs plain input without terminal emulation you can use input redirection like: +
-   +
-  echo "some input" | command+
 +WinSCP may possibly support user input. However, most commands requiring user input does that via terminal emulation features. If your command needs plain input without terminal emulation you can use input redirection like:
 +<code bash> 
 +echo "some input" | command
 +</code>

Last modified: by martin