1

In my Linux development environment I have become accustomed to building and deploying my code in one line commands, for example:

mvn clean package && ./deploy.sh localhost 

I have written bash aliases that simplify this process, in my environment the above would be aliased as:

mvncp && deploy 

I am now working in a Windows development environment, so I run commands in a very similar way:

mvn clean package && deploy.bat localhost 

To replace my aliases I have created doskey macros. Executing a macro by itself works just fine, however when I try to execute multiple macros chained together with && all macros after the first fail to be recognized.

mvncp && deploy <output omitted> [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6.588 s [INFO] Finished at: 2014-10-13T10:38:36-06:00 [INFO] Final Memory: 31M/209M [INFO] ------------------------------------------------------------------------ 'deploy' is not recognized as an internal or external command, operable program or batch file. 

Sometimes cmd reports the macro could not be found, other times it silently fails and %errorlevel% returns 0.

Is there any way I can execute multiple doskey macros as a single command in cmd?

1
  • 1
    It won't help you here, but just to clarify: in windows &means "and then", && means "and if successful, then". (to be complete: || would be "and if unsuccessful then") Commented Oct 13, 2014 at 17:02

1 Answer 1

3

The token you seek is $T

From https://en.wikipedia.org/wiki/DOSKEY

$T Command separator. Allows multiple commands in a macro.

Sign up to request clarification or add additional context in comments.

3 Comments

I use it just you, in conjunction with my maven build and it works great.
It's too bad DOSKEY doesn't recognize it's own macros.. wish I could build a macro from existing macros. Alas, this gets the job done. Thanks!
According to stackoverflow.com/questions/25044721/… it's apparently also possible to escape the & using ^. It seems like ^&^& really lets you do conditional execution.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.