-1

I'm just wondering. When I type ; in cmd, it will just ignore it.

I can type ;;;;;;;;;;;;;;; and it will do the same thing but, if I do ;a it will say error.

Why is that?

CMD ignoring <code>;</code>

aschipfl
  • 28,946
  • 10
  • 45
  • 77
  • It's a delimiter for CMD. Note `dir/?` is legal because CMD separates the command from the parameters. However most programs, but not all, require parameters to be separated by spaces, so subsequent switches have to be separated because the program parses these. –  May 06 '20 at 09:03
  • 1
    @Flimzy **`;` doesn't end the command in cmd**. Only `&`, `&&` and `|` are used for multiple commands in the same line. `;` is just a delimiter like [`` `` `;` `,` `=` `<0x0B>` `<0x0C>` and `<0xFF>`](https://stackoverflow.com/a/4095133/995714). `dir;/?` behaves just like `dir /?` instead of resulting in an error – phuclv May 06 '20 at 15:40

3 Answers3

2

; is a delimiter.

Delimiters separate one parameter from the next - they split the command line up into words.

More info on https://ss64.com/nt/syntax-esc.html

a_horse_with_no_name
  • 440,273
  • 77
  • 685
  • 758
Viraxor
  • 21
  • 3
2

The semicolon is not ignored by cmd.exe; rather is it even particularly recognised, namely as a token separator, which are used to separate commands from its arguments and arguments from each other. Here are all such characters:

  • SPACE (code 0x20)
  • TAB (horizontal tabulator, code 0x09)
  • , (comma, code 0x2C)
  • ; (semicolon, code 0x3B)
  • = (equal-to sign, code 0x3D)
  • VTAB (vertical tabulator, code 0x0B)
  • FF (form-feed or page-break, code 0x0C)
  • NBSP (non-breaking space, code 0xFF)

Note that multiple consecutive token separators are collapsed to a single one.

aschipfl
  • 28,946
  • 10
  • 45
  • 77
0

Command prompt does not ignore the character ";", ";" is a delimeter and cmd recognizes it as so so it doesn't "ignore" the character, but reads it similar to a space so nothing appears when you write it alone.