Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何向DOSKEY[CMD]添加后期修复_Batch File_Cmd_Doskey - Fatal编程技术网

Batch file 如何向DOSKEY[CMD]添加后期修复

Batch file 如何向DOSKEY[CMD]添加后期修复,batch-file,cmd,doskey,Batch File,Cmd,Doskey,我想要一个前缀来运行命令,但稍有不同,例如 openlink (opens the link) openlink *2 (opens the link twice) 然后,我希望能够通过使用前缀来说“打开它2次”,例如 openlink (opens the link) openlink *2 (opens the link twice) 我希望数字与打开的时间相对应,例如openlink*7将打开链接7次。如何将命令(openlink)包装到批处理文件中,该批处理文件使用set/a跟踪

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

openlink (opens the link)
openlink *2 (opens the link twice)
然后,我希望能够通过使用前缀来说“打开它2次”,例如

openlink (opens the link)
openlink *2 (opens the link twice)

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

如何将命令(
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次。

这是一个后期修复,而不是前缀。前面有一个前缀,看起来像:
2*openlink
。好的,很抱歉我的英语不好。中文CMD,
doskey open=for/l%A in(1$1)do start”“$2
。如果从批处理文件运行,请使用
%%A
而不是
%A
。用法,
打开3个记事本
打开3个记事本。@michael_heath完美!正是我想要的DSeems只需重复打开链接,永远
openlink
在命令行上调用standalone时具体做什么?抱歉,可能是“启动chrome(link)”“启动chrome”本身只需在中打开一个新选项卡chrome@ClarenceHog如果你发现我的答案解决了你的问题,如果可以的话,欢迎您提出其他问题。是否可以将其作为命令运行,如使用doskey运行
video 3