Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

C's system() & COMMAND.COM (Developers)

posted by bretjohn(R) Homepage E-mail, Rio Rancho, NM, 17.09.2014, 20:42

> IFF an internal command ends in .COM/.EXE, which is sick.

The fact that you think it's "sick" is irrelevant. You could have some or all of the following with the same name: a COM, EXE, BAT, and BTM file, a 4DOS alias, a DOSKEY macro, an INT 2F.AE internal extension, and an internal command (and the may even be other possibilities you could add to the list). If the user simply types the name at a command line, what happens?

The answer actually depends on what brand and version of DOS is being used, teh environment, and what TSR's and device drivers are loaded as well. What various versions of MS-DOS does is described here:

What your program should do is the same thing that would happen if the user simply typed the same thing at the command-line. The problem is there's no way you can know what that is. The only sane thing you can do is a "%COMSPEC% /C ..." and figure out some other way to return the ErrorLevel if that's critical to you.


Complete thread:

Back to the forum
Board view  Mix view
15296 Postings in 1378 Threads, 254 registered users, 15 users online (0 registered, 15 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum