Pelles C > General discussions

CreateProcess not found ?

(1/2) > >>

bitcoin:
Hello
I have simple code


--- Code: ---int entry(void)
{
WinExec("cmd.exe /k systeminfo.exe",SW_SHOW);
ExitProcess(0);
}
--- End code ---

It works, when I start it from explorer.exe / total commander / cmd.exe / etc.

But when I start it from PellesC IDE (button "Execute" under the menu) I have error "command systeminfo not found" - because cmd.exe don't found this program. Also , same errors are with ping.exe , tracert and other. Why?

TimoVJL:
Check Tools -> Options -> Projects -> Folders Executables
If C:\windows\system32 isn't there, add it.

John Z:

--- Quote from: bitcoin on November 11, 2022, 08:32:52 PM ---But when I start it from PellesC IDE (button "Execute" under the menu) I have error "command systeminfo not found" - because cmd.exe don't found this program. Also , same errors are with ping.exe , tracert and other. Why?

--- End quote ---

When the cmd window opens and displays the error method, type path <return> you will see the problem.

You could use this format as well as TimoVJL more versatile (better) solution:
 WinExec("cmd.exe /k c:\\windows\\syswow64\\systeminfo.exe",SW_SHOW);
or
 WinExec("cmd.exe /k c:\\windows\\system32\\systeminfo.exe",SW_SHOW);


John Z

BTW - if you run the resulting exe outside of Pelles UI you will see that your original code does work, and if you again type path <return> you will see why....

bitcoin:
TimoVJL, John Z
both method works, thanks!

Vortex:
Hello bitcoin,

This one works too :


--- Code: ---#include <stdio.h>
#include <windows.h>

int main(void)
{
ShellExecute(0,"open","cmd.exe","/k systeminfo.exe",0,SW_SHOW);
return 0;
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version