Executes external programs and operating system commands from C/AL programs.

[ReturnCode :=] SHELL(Name[, Param, ...])

Parameters

Name

Type: Text or code

The path and name of the command. The following rules apply:

  • You can omit the drive designation if the command is located on the current drive.

  • You can omit the full path if the command is located in the current directory.

  • You can enter only the subdirectory name if the command is located in a subdirectory of the current directory.

Param

Type: Text or code

One or more optional parameters sent with the external program or command.

The parameters cannot be passed as part of the Name parameter. The Name parameter must be filled in and it must not contain any parameters except for the executable. The parameter information must be hard-coded as a text constant or as a variable.

The SHELL function has been designed so that each user can create a list of trusted executables. This list is maintained in the user’s .zup file. The way this function works depends on whether the executable is given as a text constant or as a variable.

If the name of the executable is passed to the SHELL function as a text constant then the executable is trusted and the user is not prompted to confirm that they trust the executable. This is also the case when the executable (text constant) is called with a number of other arguments that have been assigned manually.

If the name of the executable is passed to the SHELL function as a variable then the executable is not trusted and the user is prompted to confirm whether they trust the executable the first time it is called. After the user has confirmed that they trust the executable it can be called again at any time without having to confirm that it is trusted.

Expand imageProperty Value/Return Value

Expand imageRemarks

Expand imageExample

Expand imageSee Also