hb_processrun(): How to inherit path given in system environment

77 views
Skip to first unread message

Jayadev

unread,
Apr 6, 2023, 4:03:14 AM4/6/23
to Harbour Users
Hi,

How to ensure that the hb_processrun() function inherits the system path variable to enable execution of a windows program located in %APPDATA% directory which in turn is dependent on programs defined in the path variable for proper execution?

When executing the function hb_processrun() from within a dos prompt, all the paths mentioned in the windows environment are inherited, but when executing hb_processrun() from within a windows program like one compiled with MiniGui, the paths as given in Windows environment variable is not available.

Are there any alternative ways to execute a windows program from within %APPDATA% directory through Harbour.  The windows program itself can be run by giving full path, but the windows program is dependent on other programs defined in the path for proper execution.

Warm regards,

Jayadev

Auge & Ohr

unread,
Apr 6, 2023, 4:52:56 AM4/6/23
to Harbour Users
hi,

   cEnv := Getenv("APPDATA")

Jimmy

Jayadev

unread,
Apr 6, 2023, 4:58:37 AM4/6/23
to Harbour Users
Hi Jimmy,

Thanks for your reply. 

Getenv("APPDATA") shows the expanded location path of %APPDATA% and nothing else.  I need to enable all the path as is given in the system variable path.

Warm regards,

Jayadev

Auge & Ohr

unread,
Apr 6, 2023, 5:53:25 AM4/6/23
to Harbour Users
hi,

sorry i have misunderstood you

i have not work with hb_processrun() yet
what did you get for
   msginfo( Getenv("PATH") )

Jimmy

Jayadev

unread,
Apr 6, 2023, 6:09:26 AM4/6/23
to Harbour Users
Hi Jimmy,

>>msginfo( Getenv("PATH") )

Shows gibberish meaningless data.

Warm regards,

Jayadev

Auge & Ohr

unread,
Apr 6, 2023, 6:49:45 AM4/6/23
to Harbour Users
hi,

i have try this

#include "HMG.CH"
PROCEDURE Main
   hb_ProcessRun( "DoNext",,,, .T. )
RETURN

which call DONEXT.EXE

#include "HMG.CH"
PROCEDURE Main()
LOCAL cEnv := hb_getenv( "PATH" )
   msginfo(cEnv)
RETURN

and it work like expect
can you give a Sample where it does not work ?

Jimmy
Reply all
Reply to author
Forward
0 new messages