DOS多行批处理命令.如何在参数之间添加注释? [英] DOS Multiline batch command. How to add comments between arguments?

查看:49
本文介绍了DOS多行批处理命令.如何在参数之间添加注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Id喜欢添加评论,例如:

Id like to add comments like this:

makecert -r ^        // This means SelfSigned
         -pe ^       // Private key is exportable
         -a sha512 ^ // The algoritm
         ...

这可能吗?怎么样?

推荐答案

没什么正式的,但是有一个简单而有效的技巧-使用未定义的变量.至少添加一个 = ,以确保内容不能为有效的变量名,因为不能在变量名中使用该字符.我在开头和结尾仅使用一个来表示对称性.另外,注释不能包含:.最后,连续行 ^ 字符必须是该行的最后一个字符.

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.

这篇关于DOS多行批处理命令.如何在参数之间添加注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆