Shell Running on a Windows Computer - Web 2.0

Hi team,
I’m trying to port an app from Web1.0 to Web2.0 and having some trouble getting my existing shell objects working.

I have an interactive shell object on my window and from a button press I run a number of commands:
MyShell.WriteLine “cd C:\mypath”
MyShell.writeline “test.exe”

In Web1.0, my exe will launch and MyShell dataAvailable event will fire
In Web2.0 it seems my exe launches but the data Available does not fire.

Any suggestions?

Hi again,
I’ve replicated the issue in a simple project that worked great in Web1 and doesn’t in Web2.

I have an app that automagically changes the screen to duplicate mode using a simple windows command.

InteractiveShell = New Shell
InteractiveShell.ExecuteMode = Shell.ExecuteModes.Interactive

If Not InteractiveShell.IsRunning Then
End If

InteractiveShell.WriteLine " cd C:\Windows\System32"
InteractiveShell.WriteLine “DisplaySwitch.exe /clone”

It doesn’t work with the following shell error from the dataavalable event:

Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Program Files\Xojo\Xojo 2021r1.1> cd C:\Windows\System32

C:\Windows\System32>DisplaySwitch.exe /clone’DisplaySwitch.exe’ is not recognized as an internal or external command,
operable program or batch file.


Can anyone tell me what has changed?

if the app DisplaySwitch.exe is there it could be that your xojo app / shell not have permission in this folder.

Thanks Markus, It’s really strange. This works in Web1 and if I change displayswitch to notepad (in the same folder) it launches fine. Even if I get rid of the switch (/clone) it should still run the displayswitch exe and bring up the UI.

you could compare the file permissions first between notepad and displayswitch.

hmm from normal cmd window i can run this displayswitch without any problems.

Just figured out how to make it work although I don’t know why… recompiling in 64bit allows it to work fine. Strange that I’m just trying to call an exe…

i used also 64bit and played with security privileges at build settings windows …
at least this displayswitch appear on my desktop.

Instead of calling several shell sessions in succession, call all commands on the same line, separated by “&”.

Use the full path for DisplaySwitch.exe.

InteractiveShell.WriteLine "cd C:\Windows\System32 & DisplaySwitch.exe /clone”

Thanks Michel,
I learnt something new today!

I’m still at a loss as to why the original code would work on a 64bit build but not a 32bit build?

I am actually surprised it worked at all. Xojo shell actually creates a session each time you call it, and starts at the root folder.