What "old style" is cmd /? on cmd /c talking about?!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
taripo
Posts: 228
Joined: 01 Aug 2011 13:48

What "old style" is cmd /? on cmd /c talking about?!

#1 Post by taripo » 22 Aug 2022 19:19

So cmd /? mentions

Code: Select all

    
    1.  If all of the following conditions are met, then quote characters
        on the command line are preserved:

        - no /S switch
        - exactly two quote characters
        - no special characters between the two quote characters,
          where special is one of: &<>()@^|
        - there are one or more whitespace characters between the
          two quote characters
        - the string between the two quote characters is the name
          of an executable file.

    2.  Otherwise, old behavior is to see if the first character is
        a quote character and if so, strip the leading character and
        remove the last quote character on the command line, preserving
        any text after the last quote character.

What it describes as "old behaviour"..

Is it trying to suggest that at one point in time, there was only this behaviour, and not the newer behaviour?

I just started up virtualbox with a windows 98 boot disk.

There was no COMMAND /S in MSDOS 6.22 https://web.archive.org/web/20070108185 ... ommand.htm And there wasn't in Win98 DOS either. So maybe that DOS is "old style"?

Code: Select all

C:\>COMMAND.COM /C "C:\ABC\Z Z\AZIB.EXE"
Bad command or file name
^ above output is correct, there is no file AZIB.EXE and it didn't choke on the space in the path.

Compare that with the so-called "old behaviour" done by CMD, which is broken

Code: Select all

C:\Users\User>cmd /s /c "c:\carp\v v\w.exe"
'c:\carp\v' is not recognized as an internal or external command, operable program or batch file.

C:\Users\User>
So what "old behaviour is it talking about"!!!

Here's a weird one.. In the Windows 98 setup in VitrualBox, when I tried

Code: Select all

C:\>COMMAND.COM /C "ECHO ABC"
Bad command or file name

C:\>
BTW.. COMMAND.COM /C ECHO ABC worked.

So on Win98 DOS, It went a bit mad on COMMAND.COM /C "ECHO ABC", and it didn't work..

Whereas CMD's "old style",

Code: Select all

C:\Users\User>cmd /S /C "ECHO ABC"
ABC

C:\Users\User>
So if CMD with /S /C is meant to be simulating some old behaviour, then I can't see what system has the old behaviour that it is simulating. Any idea?

Do you know if it's simulating an old NT system?

batmanbatmanbatmen
Posts: 9
Joined: 23 Sep 2022 22:13

Re: What "old style" is cmd /? on cmd /c talking about?!

#2 Post by batmanbatmanbatmen » 24 Sep 2022 02:49

I am not professional on cmd & command. I guess command.com is old style that did not support quote "...". It the past, file is 8.3 format. It assume no space that it should not have quote.

Post Reply