sysutils.shellexec(action, file, [parameters], [directory])

Performs an operation on a file or folder, such as opening, printing, or exploring.

Parameters

action

A string that indicates the action to perform on the provided file/directory. The following verbs are commonly used

  • "open": opens the file/directory.
  • "openas": shows a dialog to select an app with which to open the file.
  • "runas": launches an application as Administrator, with UAC prompt if needed.
  • "edit": launches an editor to edit the file.
  • "print": prints the file.
  • "properties": shows the file/folder properties.
  • "explore": explores the specified folder.
  • "find": start a search starting from the specified directory.

file

The file or directory on which the action will be performed on, as a string, as a File, or as a Directory

[parameters]

An optional string that contains the application parameters, separated by spaces.

[directory]

An optional string that contains the name of the application working directory.

Return value

Returns a boolean value indicating if the shell execution succeeded or not.

Example

local sysutils = require "sysutils" -- opens the current mail app to write a new mail to test@test.com print(sysutils.shellexec("open", "mailto:test@test.com"))