Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

run

Windows program for running other programs in a controlled fashion

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

run

Windows program for running other programs in a controlled fashion.

AUTHOR

Bill Stewart - bstewart at iname dot com

LICENSE

run is covered by the GNU Public License (GPL). See the file LICENSE for details.

DOWNLOAD

https://github.com/Bill-Stewart/run/releases/

SYNOPSIS

run is a Windows program that runs other programs in a controlled fashion.

USAGE

run [parameters] [program [-- ...]]

Parameter names are case-sensitive. Parameter names can be specified partially if enough of the parameter name is specified to prevent ambiguity.

PARAMETERS

The run program's parameters are as follows:

  • --workingdirectory="path" - Specify a working directory
  • --elevate - Request elevation (run as administrator)
  • --help - Display usage information
  • --programinexedir - Specifies that the program is in the same directory as the executable (see below)
  • --quiet -Suppress error messages
  • --wait - Wait for the program to exit and return its exit code
  • --windowstyle=style - Specify a window style (see below)
  • program - Specify the filename of the program to run
  • Everything after -- is parameters for the program

Notes:

  • If the program name, a parameter, or a parameter's argument contains spaces, enclose it in " characters. For example:

    run --workingdirectory="C:\Program Files" "C:\Program Files\Files\Test\test.exe"

  • The program name can be the name of a document file. In this case, run will start the program associated with the document and open the document. If the file doesn't have an association, Windows will prompt for an application to use to open the document. (This may vary depending on Windows version or other settings.)

  • If elevating a program in the Windows or System32 directory, the working directory is always the System32 directory. In this case run ignores the --workingdirectory parameter.

  • You can use the --programinexedir parameter if the program sits in the same directory as the run.exe file. (This can be useful in cases where you don't know the path of the program, such as when executing a startup script in a domain.)

  • The --windowstyle parameter's argument must be one of the following: Normal, Minimized, Maximized, Hidden, NormalNotActive, or MinimizedNotActive (the argument is not case-sensitive),

  • If you don't specify a directory name for the program (i.e., you specify only a filename), run will search the directories in the Path.

  • The filename extension of the program (e.g., .exe) is required.

  • It's recommended to use the 64-bit (x86_64) version of run on 64-bit operating systems.

EXIT CODES

The exit code will be 0 for success, non-zero for error.

If you use the --wait parameter, the exit code will be the program's exit code if the program executed successfully. If run did not successfully execute the program, the exit code will be 1003 (Win32 error 0x3EB, ERROR_CAN_NOT_COMPLETE).

You can check a program's exit code:

  • In PowerShell using the $LASTEXITCODE variable
  • In cmd.exe using the %ERRORLEVEL% variable

TECHNICAL

run uses the ShellExecuteEx Windows API function.