2,782 questions
Usually you can use system or _wsystem, for example: system("dir C:\").
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);