NO

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

Offline EdPellesC99

  • Member
  • *
  • Posts: 185
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

Offline EdPellesC99

  • Member
  • *
  • Posts: 185
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: 383
    • 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: 1745
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

Offline EdPellesC99

  • Member
  • *
  • Posts: 185
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

Offline EdPellesC99

  • Member
  • *
  • Posts: 185
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.....