如何将后缀添加到DOSKEY [CMD]

时间:2019-03-05 17:20:53

标签: batch-file cmd doskey

我想要一个前缀来运行命令,例如,稍有不同

openlink (opens the link)

然后我想说两次,例如使用前缀将其打开

openlink *2 (opens the link twice)

我希望数字对应于打开的时间,例如。 openlink * 7将打开链接7次。

1 个答案:

答案 0 :(得分:1)

如何将命令(openlink)包装在使用set /A来跟踪计数的批处理文件中?

@echo off
SET /A CNT=%1
:l0
    openlink foo
    SET /A CNT=%cnt%-1
    IF NOT %cnt% == 0 GOTO l0
:end

然后,您可以像myopenlink.bat N一样调用它,以调用openlink foo N次。