Clarence Hog
Clarence Hog

Reputation: 13

How to add a post-fix to a DOSKEY [CMD]

I would like a prefix to run a command but slightly differently, for example

openlink (opens the link)

Then I would like to be able to say open it 2 times by using a prefix, for example

openlink *2 (opens the link twice)

I would like the number to be corresponding to the times opened Eg. openlink *7 would open the link 7 times.

Upvotes: 1

Views: 294

Answers (1)

Govind Parmar
Govind Parmar

Reputation: 21542

How about wrapping your command (openlink) in a batch file that uses set /A to keep track of a count?

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

Then, you could call it like myopenlink.bat N to call the command openlink foo N times.

Upvotes: 1

Related Questions