Different result between Shell and Dos prompt


I got different result between DOS prompt running and running shell in Xojo.

  Dim Sh as new Shell
  Dim statement As String = "C:\\fs.bat test.exe"
  MsgBox " CommandStatement : " + statement
  MsgBox " shell result : " + Sh.Result

When I run below command in Dos, the result shows :
c:\>fs.bat test.exe
It shows the correct size of the file.

@echo off
echo %~z1

However, by running it through xojo Shell, I got “ECHO is off” which just shows that the file size is zero.

What do you think is the difference from them?
Dos running result is the correct one.

When you execute the command from the DOS prompt, you are in the scope of the environment where the file exists.

When you run it from SHELL, you may (and probably are) executing from a totally different location (most likely the default path of the app executing the SHELL). So, perhaps the ZERO returned result is actually the result of “FILE NOT FOUND”

Try executing the command with the full path to “test.exe” in both situations, and see if the results are STILL different

Added to what Dave said, you are actually executing 2 different commands. It may not make a difference in your specific environment, but it could. That said, Dave is spot on when he says the result of 0 bytes means the file is not in your current working directory.

Yes you’re right.
When I put the full path, the shell result also shows the correct value.

Dim statement As String = "C:\\fs.bat C:\\test.exe"

It was a tiny mistake but it made a big difference.
Thank you so much.