Setting the drive, e.g. ‘C:’, cannot be the first command specified in Sys_execute because it will not set the drive correctly.

To work around this start the Sys_execute function with a command that is allowed to be specified first, e.g. 'Cls', and then use the (&) operator to join the commands required to set the drive, set the path, and run the program (such as a Jar file), e.g. "Cls & C: & cd C:\MyAppFolder\ & java -jar JavaClient.jar".

The execution mode EM_WAIT_UNTIL_FINISHED makes the function wait for the call to finish before executing a command.  The example below will capture output from a command prompt when the default home drive is different to the drive where the application Jar file is located.

 
[ ] LIST OF STRING lsOut
[ ] 
[ ] Sys_Execute ("Cls & C: & cd C:\MyAppFolder\ & java -jar JavaClient.jar", lsOut, EM_WAIT_UNTIL_FINISHED)
[ ] 
[ ] listprint (lsOut)

Incident #2598700