Differences

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

custom_command 2023-02-09 custom_command 2026-02-09 (current)
Line 1: Line 1:
====== Custom Commands ====== ====== Custom Commands ======
-If there is a [[remote command]] you need to execute regularly and in particular if the command works with files, you may find custom commands useful.+If there is a [[remote_command|remote]] or local command you need to execute regularly and in particular if the command works with files, you may find custom commands useful.
A custom command is a [[ui_pref_commands|predefined]] command which can contain several patterns that WinSCP replaces, for example, with names of files selected in a panel (see below). For example, the pre-defined custom command //Touch//, defined as ''touch %%"!"%%'', calls the ''touch'' command on every selected file in the remote panel. A custom command is a [[ui_pref_commands|predefined]] command which can contain several patterns that WinSCP replaces, for example, with names of files selected in a panel (see below). For example, the pre-defined custom command //Touch//, defined as ''touch %%"!"%%'', calls the ''touch'' command on every selected file in the remote panel.
Line 27: Line 27:
| ''!P''  | Any          | Current session password (if [[security_credentials|stored or remembered]]). | | ''!P''  | Any          | Current session password (if [[security_credentials|stored or remembered]]). |
| ''!#''  | Any          | Current session port number. | | ''!#''  | Any          | Current session port number. |
-| ''!K''  | Any          | Current session private key. &beta_feature |+| ''!K''  | Any          | Current session private key. |
| ''!N''  | Any          | Current session name. | | ''!N''  | Any          | Current session name. |
| ''!?prompt[\]?default!'' | Any | When used, user is prompted to enter value that replaces the pattern. ''prompt'' can define a message of the prompt and ''default'' a default value, both can be empty. Special characters entered by user are automatically delimited. You can prohibit this using optional backslash (''\'') before second question mark (''?''). \\ When implementing an [[extension]], use a runtime [[extension#options|option]] instead, as a more flexible alternative. | | ''!?prompt[\]?default!'' | Any | When used, user is prompted to enter value that replaces the pattern. ''prompt'' can define a message of the prompt and ''default'' a default value, both can be empty. Special characters entered by user are automatically delimited. You can prohibit this using optional backslash (''\'') before second question mark (''?''). \\ When implementing an [[extension]], use a runtime [[extension#options|option]] instead, as a more flexible alternative. |
Line 37: Line 37:
===== [[executing_and_configuring]] Executing and Configuring Custom Commands ===== ===== [[executing_and_configuring]] Executing and Configuring Custom Commands =====
-Custom commands that operate with files are located in menu //File(s) > File Custom Commands//, in file [[ui_context_menu|context menu]] and on special //[[ui_toolbars#custom_command|Custom Command toolbar]]//.+Custom commands that operate with files are located in menu //Files > File Custom Commands//, in file [[ui_context_menu|context menu]] and on special //[[ui_toolbars#custom_command|Custom Command toolbar]]//.
Custom commands that do not operate with files are located in menu //Commands > Static Custom Commands//, and on special //[[ui_toolbars#custom_command|Custom Command toolbar]]//. Custom commands that do not operate with files are located in menu //Commands > Static Custom Commands//, and on special //[[ui_toolbars#custom_command|Custom Command toolbar]]//.
Line 43: Line 43:
Custom commands can be configured in [[ui_pref_commands|Preferences]]. Custom commands can be configured in [[ui_pref_commands|Preferences]].
-You may eventually want to execute ad hoc custom command, without predefining it first. To do so, go to //File(s) > Custom Commands > Enter//. To repeat the last ad hoc custom command, go to //File(s) > Custom Commands > Last//.+You may eventually want to execute ad hoc custom command, without predefining it first. To do so, go to //Files > Custom Commands > Enter//. To repeat the last ad hoc custom command, go to //Files > Custom Commands > Last//.
Custom commands that are executed [[#types|both with local and remote files]] can be used on [[ui_synchronize_checklist|synchronization checklist window]]. Custom commands that are executed [[#types|both with local and remote files]] can be used on [[ui_synchronize_checklist|synchronization checklist window]].

Last modified: by martin