Why does the statement, "SYSTEM dir" not work in dL4 for Windows?

The dir command is not a separate program, it is part of cmd.exe (or command.com on older systems). The proper syntax to execute a dir command would be "SYSTEM command.com /c dir". The directory driver should be used instead of the "dir" command for maximum portability. The following program displays all filenames in current directory.

10
Dim r$[100]
20
Open #0,"." As "directory"
30
Do
40 Read #0;r$
50 If r$ = "" End
60 Print r$
70 Loop
80 End