【问题标题】:Batch set a variable via command通过命令批量设置变量
【发布时间】:2018-11-18 16:37:39
【问题描述】:

我需要设置一个作为命令传递的变量。

例如,命令是这样的:

github "Init command"

我必须执行的命令是这样的:

git add. && git commit -m "/TItle" && git push origin master

"Init command""/Title"

【问题讨论】:

    标签: windows batch-file variables cmd


    【解决方案1】:

    恕我直言,最简单的方法是创建一个函数:

    github() {
        # $1 is the (1st) parameter passed to the function
        git add . && git commit -m "$1" && git push origin master
    }
    

    【讨论】:

    • 感谢您回答为什么要使用该功能而不是简单的 git add。 && git commit -m "$1" && git push origin master?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-16
    • 2017-04-20
    • 1970-01-01
    • 2015-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多