samedi 10 août 2019

Is the block of if statement in DOSBox different than in MS-DOS?

I made a batch file in MS-DOS and it worked.

Considering that DOSBox is the same as MS-DOS, I just ran the same code and it did not work. And I noticed that there could be some difference as stated in https://stackoverflow.com/questions/tagged/dosbox+batch-file

This is the batch file content

@echo off

:: Verbose usage
if "%1"=="" (
    echo Usage: tpc [file]
    echo file    a Turbo Pascal file
    goto eof
)

set file=%1
c:\tpwdb\bin\tpc %file%

echo.

echo Execute with %file%

:eof

In MS-DOS it produced

Usage: tpc [file]
file    a Turbo Pascal file

>tpc 02\hellow.pas
This version of c:\tpwdb\bin\TPC.EXE is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Execute with 02\hellow.pas

but in DOSBox it produced

Illegal command: (.
Usage: tpc [file]
file    a Turbo Pascal file

>tpc 02\hellow.pas
Usage: tpc [file]
file    a Turbo Pascal file

which shows that it did not recognize if block ( ) and when there was argument passed, it still execute the block.

Aucun commentaire:

Enregistrer un commentaire