Pelles C forum

C language => Expert questions => Topic started by: EdPellesC99 on September 05, 2018, 05:17:12 pm

Title: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: EdPellesC99 on September 05, 2018, 05:17:12 pm
If I simply double click the .cmd file it runs the msgbox.exe fine.

If I try to run the .cmd file from a c program, the console window says it cannot find the file (even though the titlebar of the console window says I am in System32.

What works ?
If I put the msgbox.exe in the folder of my project file, it runs the .exe just fine.

I am sure I will have to post alot of details to get any clues, but for starters I will post this  !
Thanks,
Ed
Title: Re: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: EdPellesC99 on September 05, 2018, 08:57:47 pm
I suspected that perhaps the batch file was not being run as an administrator, when run from my c program: I added code to the batch file to determine privedges, and when run from the c program it was being run as an administrator.

When I double click the .cmd file it is also being run as an administrator and has no problem bringing up the msgbox.exe within System32.

Certainly a puzzle to me.
Title: Re: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: AlexN on September 06, 2018, 08:53:20 am
Check the environment variables, which are set when you run the .cmd file from the .c file.
Perhaps PATH has not the expected content.

Regards
Alex  ;)
Title: Re: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: TimoVJL on September 06, 2018, 12:43:17 pm
Is it 32/64-bit path issue ?
What OS ? 32-bit or 64-bit ?
Is the msgbox.exe 32-bit or 64-bit and placed where ? system32 ? SysWOW64 ?

Code: [Select]
@ECHO %PROCESSOR_ARCHITECTURE%
@PATH
start %windir%\system32\winver.exe
pause
Title: Re: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: EdPellesC99 on September 06, 2018, 08:59:12 pm
Give me a few days to respond, I live on a small farm and have three days of heavy rain coming.
Thanks for the interest, will get back.

Regards, Ed
Title: Re: Issues running a .cmd file that runs a program (a msgbox window) in System32
Post by: EdPellesC99 on October 10, 2018, 09:42:24 pm
Sorry for the delay. Yes it appears it was just a path issue.
Guess this was a brain dead post !
Thanks all for bothering to read.....