How to start using Shell class

Hello,
I’m trying to use the Shell class to execute a program that programs a microcomputer using a Multilink FX. The program is PROGHCS08 by P&E Micro.
I am writing a GUI to interface with the PROG program and Multilink to program S19 files into a target MCU system.

So far, to get started, I have adapted a short program from an old textbook, as shown below:

Var sh as Shell
sh = New Shell
sh.execute(“dir”)
TextArea1.text = sh.result
sh.Close

When I run this, I get the following text, as shown below. The path is the folder where my Xojo executables reside. If I modify the above program to replace the “dir” with “cd…” or any other command to go to another path/folder, I get the same results. The Shell keeps coming back to the Xojo path.

Suggestions are appreciated!

Thanks,
Dave

Volume in drive C has no label.
Volume Serial Number is 76B9-2D21

Directory of C:\Program Files\Xojo\Xojo 2023r2

09/07/2023 07:43 PM .
09/07/2023 07:43 PM …
08/07/2023 01:31 PM 274,944 cefsubproc.exe
08/07/2023 01:31 PM 639,501 chrome_100_percent.pak
08/07/2023 01:31 PM 960,892 chrome_200_percent.pak
08/07/2023 01:31 PM 1,191,424 chrome_elf.dll
08/07/2023 01:31 PM 58,248 concrt140_app.dll
08/07/2023 01:31 PM 4,891,080 d3dcompiler_47.dll
09/07/2023 07:43 PM Extras
08/07/2023 01:31 PM 27,980,288 icudt65.dll
08/07/2023 01:31 PM 10,404,784 icudtl.dat
08/07/2023 01:31 PM 2,573,824 icuin65.dll
08/07/2023 01:31 PM 1,815,040 icuuc65.dll
08/07/2023 01:31 PM 170,399,232 libcef.dll
08/07/2023 01:31 PM 421,376 libEGL.dll
08/07/2023 01:31 PM 6,347,776 libGLESv2.dll
09/07/2023 07:43 PM locales
08/07/2023 01:31 PM 110,800 Microsoft.Toolkit.Win32.UI.XamlHost.dll
08/07/2023 01:31 PM 6,430,616 Microsoft.UI.Xaml.dll
08/07/2023 01:31 PM 625,600 Microsoft.Web.WebView2.Core.dll
08/07/2023 01:31 PM 660,128 msvcp120.dll
08/07/2023 01:31 PM 567,688 msvcp140.dll
08/07/2023 01:31 PM 19,336 msvcp140_1_app.dll
08/07/2023 01:31 PM 21,384 msvcp140_2_app.dll
08/07/2023 01:31 PM 259,968 msvcp140_app.dll
08/07/2023 01:31 PM 963,232 msvcr120.dll
09/07/2023 07:43 PM Plugins
09/07/2023 07:43 PM Project Templates
09/07/2023 07:43 PM Read Mes
08/07/2023 01:31 PM 7,265,241 resources.pak
08/07/2023 01:31 PM 18,962,536 resources.pri
09/07/2023 07:41 PM Scripts
08/07/2023 01:31 PM 408,176 snapshot_blob.bin
09/07/2023 07:43 PM swiftshader
09/07/2023 07:43 PM 2,462,287 unins000.dat
09/07/2023 07:41 PM 3,273,728 unins000.exe
09/07/2023 07:43 PM 24,097 unins000.msg
08/07/2023 01:31 PM 731,008 v8_context_snapshot.bin
08/07/2023 01:31 PM 46,984 vcamp140_app.dll
08/07/2023 01:31 PM 335,240 vccorlib140.dll
08/07/2023 01:31 PM 51,080 vccorlib140_app.dll
08/07/2023 01:31 PM 25,480 vcomp140_app.dll
08/07/2023 01:31 PM 97,168 vcruntime140.dll
08/07/2023 01:31 PM 37,264 vcruntime140_1.dll
08/07/2023 01:31 PM 18,824 vcruntime140_1_app.dll
08/07/2023 01:31 PM 22,920 vcruntime140_app.dll
08/07/2023 01:31 PM 4,010,496 vk_swiftshader.dll
08/07/2023 01:31 PM 106 vk_swiftshader_icd.json
08/07/2023 01:31 PM 808,448 vulkan-1.dll
09/07/2023 07:41 PM Xojo Libs
09/07/2023 07:42 PM Xojo Resources
08/07/2023 02:53 PM 361,892,864 Xojo.exe
08/07/2023 01:31 PM 4,471,984 XojoWinUIFramework64.dll
42 File(s) 642,563,092 bytes
11 Dir(s) 139,228,651,520 bytes free

Shell is not a terminal and it doesn’t store any state in the default synchronous mode. If you want to send a series of commands, you should change the mode to Interactive, implement the DataAvailable event and then send the commands.

Keep in mind that Shell also does not have a user environment set up. So the default paths aren’t there either. You will need to use full paths for non built-in commands.