I have a problem with shell.Execute(test) on Windows Desktop. It only works partially

I am facing an issue with executing a command using shell.Execute() in Xojo. The command does not run properly, so I tried to execute it through a batch file, hoping that would work.

Here is my batch file:

cd "C:\Users\Bernie\AppData\Roaming\PanScan Parameters\"
C:\PROGRA~1\UVNCBV~1\UltraVNC\VNCVIE~1.EXE -config "uvnc4PanScanPar.vnc"

When I run this batch file directly, it works perfectly. However, when Xojo runs the batch file using shell.Execute("File.BAT"), it only starts the EXE file, but the additional parameters from the .vnc file are ignored.

To change the s.ExecuteMode = Shell.ExecuteModes.Synchronous doesn’t change something.

Do you have any ideas on how to make the batch file run correctly through Xojo?

Probably because the working directory of the Shell is not in the same place as you are running it from. Instead of using the cd command, I suggest you use an absolute path for the .vnc file.

C:\PROGRA~1\UVNCBV~1\UltraVNC\VNCVIE~1.EXE -config "C:\Users\Bernie\AppData\Roaming\PanScan Parameters\uvnc4PanScanPar.vnc"

if you want to check my theory, make a bat file that looks like this:

cd "C:\Users\Bernie\AppData\Roaming\PanScan Parameters\"
cd

and then check the output of the shell.

Thanks Greg!

Your suggestion helped me to find a bug in my code.

Best regards Bernd

1 Like