2

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?

Cristian E.
  • 3,116
  • 7
  • 31
  • 61

1 Answers1

2

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.

dbenham
  • 127,446
  • 28
  • 251
  • 390
  • And it's also possible to put the comment just behin the caret. Like `makecert -r ^%= My comment =%` – jeb Feb 24 '15 at 16:21
  • @jeb, yes, as long as there is no space between `^` and `%= comment =%`. Probably safer to recommend that `^` be at the end. – dbenham Feb 24 '15 at 16:44
  • You're right. It's safer to place the caret at the end to avoid accidencially problems – jeb Feb 24 '15 at 16:53