Execute Application via ShellExecute - Delphi

DarkCoderSc personal avatar
DarkCoderSc

Jean-Pierre LESUEUR

uses
  Winapi.ShellAPI, Winapi.Windows;

// ...

// No parameter
ShellExecute(0, 'open', 'notepad.exe', nil, nil, SW_SHOW);

// ...

// With parameter
ShellExecute(0, 'open', 'notepad.exe', 'C:\Temp\file1.txt', nil, SW_SHOW);

// ...

// Run as Administrator (Prompt)
ShellExecute(0, 'runas', 'notepad.exe', nil, nil, SW_SHOW);

Creating and researching code snippets takes time and effort. You’re welcome to share them through your own platforms, but please don’t forget to credit the original author, here: Jean-Pierre LESUEUR.

Implemented By Technique

Featured Windows API


Created

May 9, 2025

Last Revised

May 9, 2025