question

johnweiss-2130 avatar image
0 Votes"
johnweiss-2130 asked Castorix31 answered

Win API To Run Arbitrary Command?

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

windows-api
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

Usually you can use system or _wsystem, for example: system("dir C:\\").

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered

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);

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.