NO

Author Topic: Issues running a .cmd file that runs a program (a msgbox window) in System32  (Read 5115 times)

EdPellesC99

  • Guest
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

EdPellesC99

  • Guest
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.

Online AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
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  ;)
best regards
 Alex ;)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
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
« Last Edit: September 06, 2018, 12:56:47 PM by TimoVJL »
May the source be with you

EdPellesC99

  • Guest
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

EdPellesC99

  • Guest
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.....