What's the difference between using -
and /
in the CMD for example in the command:
shutdown -s
or
shutdown /s
What's the difference between using -
and /
in the CMD for example in the command:
shutdown -s
or
shutdown /s
Originally, DOS / Windows systems use /
to supplement commands, while on other systems such as Unix-based systems, -
is used to complement commands. However, the /
is only a convention (eg, ipconfig /all
), allowing the use of parameters via -
. Usually the use of -
as a parameter serves more as a way to make code closer to POSIX systems.
This is a feature of the shutdown
command, the program interprets as you want, for example if you create a program in Python (3):
import sys
print ("\n".join(sys.argv))
And so call on the terminal or cmd:
python arquivo.py -foo -bar -baz
will print this:
-foo
-bar
-baz
If you do this
python arquivo.py /foo /bar /baz
Will print this:
/foo
/bar
/baz
In other words, the program internally receives as described for each spacing, but it is the one that deals internally, so it will probably identify /s
and -s
as being the same, if desired, using if
or switch
or what the language supports.
shutdown
specifically probably supports both because of ease and / or portability between versions of Windows, it is not necessarily a programming problem, but a personal choice of who developed it (microsoft?!)