In Windows, command line options are preceded by /
, sometimes by -
. Is there a way to query Windows for this character? In MS-DOS, there was a SWITCHAR
setting in config.sys
. Is there a similar setting or system resource which can be obtained from Windows? Or should my command-line app simply use /
or -
without looking anywhere?
I don't think there was ever a way that this was exposed externally. Perhaps some DOS 2.0 commands checked it, but nothing else did.
"SWITCHAR was never really supported, even by DOS commands (let alone third-party programs)." [source]
I assume third-party programs were expected to parse config.sys themselves. I don't think there was any Windows support to get this particular value. (A Larry Osterman blog post talks about the history of SWITCHAR and hints that there might have been OS support for it once upon a time.)
Best practice is to allow either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With