NO

Author Topic: CreateProcess not found ?  (Read 180 times)

Offline bitcoin

  • Member
  • *
  • Posts: 157
CreateProcess not found ?
« on: November 11, 2022, 08:32:52 pm »
Hello
I have simple code

Code: [Select]
int entry(void)
{
WinExec("cmd.exe /k systeminfo.exe",SW_SHOW);
ExitProcess(0);
}

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?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2006
Re: CreateProcess not found ?
« Reply #1 on: November 12, 2022, 09:18:00 am »
Check Tools -> Options -> Projects -> Folders Executables
If C:\windows\system32 isn't there, add it.
« Last Edit: November 12, 2022, 11:36:42 am by TimoVJL »
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 508
Re: CreateProcess not found ?
« Reply #2 on: November 12, 2022, 12:58:36 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?

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....
« Last Edit: November 12, 2022, 01:32:49 pm by John Z »