polina-c
polina-c

Reputation: 7077

Windows batch: How can I ran multiple aliases in single line

I'd like to set alias for combination of aliases.

My aliases are declared like this:

doskey h=cd c:\sources\dev\folder1
doskey t=cd c:\sources\dev\folder2

I'd like to create alias that performs sequence of operations. Like this:

h && somecommand && t  

But, when I run this, only first command gets executed. Where the problem could be?

Upvotes: 2

Views: 609

Answers (2)

Harry_T
Harry_T

Reputation: 56

Anders already anwsered the question, something I want to fillup is that the syntax should be "^&" rather than "&", so the command should like

doskey test = cd c:\sources\dev\folder1 ^&^& somecommand ^&^& cd c:\sources\dev\folder2  

Upvotes: 0

Anders
Anders

Reputation: 101616

I don't think you can execute multiple aliases in one line.

I assume it is because of this little nugget:

You cannot run a doskey macro from a batch program

You can however put multiple commands in a single alias:

doskey test=dir $T echo dir completed...

Upvotes: 1

Related Questions