windowscommand-linealiasdoskey

How to define a DOSKEY alias for multiple commands?


Following on from an answer to this question

For the Windows command prompt I can define aliases as follows:

@echo off
DOSKEY ns=npm start
DOSKEY nsr=npm run serve

I want to define an alias that will combine these two commands. I tried the following:

@echo off
DOSKEY nss=npm start && npm run serve

When I try to open the command prompt the window will open but the > prompt does not appear.

I think that the inclusion of && is causing a problem.


Solution

  • I looked at an answer to a question on superuser. The following approach resolved my problem:

    @echo off
    DOSKEY nss=npm start ^&^& npm run serve