问题
Id like to add comments like this:
makecert -r ^ // This means SelfSigned
-pe ^ // Private key is exportable
-a sha512 ^ // The algoritm
...
Is this possible? How?
回答1:
Nothing official, but there is a simple and very effective hack - use undefined variables. At least one =
is added to guarantee that the content cannot be a valid variable name, since the character cannot be used in a variable name. I use one at the beginning and end just for symmetry. Also, the comment cannot contain %
or :
. Finally, the line continuation ^
character must be the last character in the line.
makecert -r %= This means SelfSigned =% ^
-pe %= Private key is exportable =% ^
-a sha512 %= The algoritm =% ^
...
Note - this only works within a batch script. It cannot be used on the command line.
来源:https://stackoverflow.com/questions/28697592/dos-multiline-batch-command-how-to-add-comments-between-arguments