メインコンテンツまでスキップ
バージョン:25.2

shellCommand

  • global property
  • This property controls which shell program is used to run the command when you use the shell command or function. By default, on Mac and Linux the shellCommand is set to /bin/sh (the Bourne shell). To run commands in a different shell, set the shellCommand to the full path of the shell you want to use before calling the shell function, or to "ShellExecute" or empty.

On Windows, the default setting of the shellCommand global property is ShellExecute. This setting causes the Windows ShellExecute() function to be used to run the specified file.

When using ShellExecute on Windows, several additional parameters besides the command or file can optionally be passed. The second parameter, if given, specifies any parameters to be passed to the command being run. The third parameter specifies the default working directory for the action. The fourth parameter should be a number specifying any optional flags to pass to the underlying ShellExecute() function. Finally, the fifth parameter, if given, specifies an explicit verb to use (such as open, explore, edit, find, or print). Otherwise the default verb defined in the registry (or open) will be used. (When using ShellExecute, no output is returned.) If an error occurs, the result will be set to a number; otherwise it will be empty.

When the shellCommand is not empty and is not set to ShellExecute (the usual case on Mac and Linux, where it is set to /bin/sh by default), if multiple parameters are passed to the shell function, they are treated as separate commands to each be run in sequence within a single shell context.

When the shellCommand is empty, shell treats its first parameter as the command to run and any additional parameters as parameters to be passed to that command. If only a single parameter is passed, it is split by any spaces that are present in the parameter to derive the command and its parameters.

  • Related: shell