doomista
doomista

Reputation: 521

Preserving doskey context after pipe, or, and

I have multiple doskeys defined in following fashion:

doskey ll=dir $*
doskey grep=findstr $*
doskey make=mingw32-make $*

I want to use them in conjunction in one-line commands such as:

ll | grep my_folder

or

make && make install

But after first pipe/not/and operator, the doskeys no longer appear to exist since the cmd won't recognize the commands. For example, while single make command works, calling echo hello && make will tell me the make is not recognized as a command.

Is there a way to preserve the doskey context so I can chain them together as written above?

Also, the same issue applies to running batch files using the doskeys, is there a way to preserve the context for that too?

I've heard about the $T argument of doskey, but I am not quite sure if I understand it.

Thanks for help in advance

Upvotes: 4

Views: 1297

Answers (1)

DanyGee
DanyGee

Reputation: 113

I had a similar issue...
Following macro was not handling the section after the | character:

doskey system=systeminfo | findstr /C:"OS"

But, the following did:

doskey system=systeminfo $B findstr /C:"OS"

So, looks like doskey's pipe symbol is $B.

Upvotes: 6

Related Questions