Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,755 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
What's API to execute an arbitrary command-line command?
ShellExecuteEx seems only appropriate if you're using a verb, like open
or edit
.
thx
Usually you can use system or _wsystem, for example: system("dir C:\").
You can use ShellExecute with NULL for default or "open" verb :
HINSTANCE h = ShellExecute(NULL, NULL, L"cmd.exe", L"/c dir c: > c:\\temp\\test.txt", NULL, SW_HIDE);