ShellExecute()
is an API wrapper around the Windows API with the same name. Using ShellExecute()
you can:
- Open Web URLs
- Open files by filename in their associated application
- Open local folders in Explorer
- Open Application Protocol Handlers
- Open OS applications that are on the OS path without a path
Here are some examples:
ShellExecute("https://west-wind.com") && opens in Web Browser
ShellExecute("c:\temp") && opens folder in Explorer
ShellExecute("c:\temp\test.pdf") && opens PDF in PDF viewer
ShellExecute("skype:8083215555") && Opens Skype
ShellExecute("markdownmonster:untitled") && Opens associated application
ShellExecute("code") && Opens VS Code (if installed)
ShellExecute can also execute commands with a complex commandline. Unlike the RUN
command ShellExecute()
works with long filenames or filenames with spaces in them.
ShellExecute("c:\Program Files (x86)\Markdown Monster\mm.exe", ;
"OPEN","c:\temp",;
["c:\temp\Getting Started With MM.md" ".\test.md"])
For command line execution you might find ExecuteCommandline()
a little simpler as you can write it the same way as you would from the Terminal as a single line:
ExecuteCommandLine([c:\Program Files\Markdown Monster\mm.exe "c:\temp\Getting Started With MM.md"])
o.ShellExecute(tcUrl, tcAction, tcDirectory, tcParameters)
Parameters
tcUrl
A URL or 'command line' that can be a path, a filename, an Application Protocol handler directive.
tcAction
A shell action that is used with this command. The default is OPEN
which is the command that every shell item supports, but some support others like EDIT
or PRINT
.
tcDirectory
An optional start directory that's used for executable commands. Useful if you execute an application explicitly.
tcParameters
Command Line Parameters. Recommend you use ["Parm1" "Parm2" "Parm3"]
style as parameters that include spaces or other special characters need to be wrapped in single or double quotes.
See also:
Class wwUtils | wwUtils::ExecuteCommandLine | CreateProcess | CreateProcessEx© West Wind Technologies, 1996-2024 • Updated: 05/14/20
Comment or report problem with topic