Create cmd shortcut to open directory and automatically run Angular command ng serve

  angular-cli, batch-file, cmd, shortcut, windows

I want to have a shortcut on my desktop that opens cmd, navigates to my Angular directory and runs the command ng serve -o

Adding this to a shortcut will open the right directory:

%windir%system32cmd.exe /k " cd & cd "C:MyAngularDirectory" 

However when I add another (Angular cli) command it does not execute automatically. This does not work for example:

%windir%system32cmd.exe /k " cd & cd "C:MyAngularDirectory" & ng serve -o

I have tried creating a bat file but can’t get it to work.

Source: Windows Questions

LEAVE A COMMENT