francoboy7's avatar

ConEmu (Cmder) quick question

Hi guys

I'm using Cmder as my terminal and I was wondering how to set up an alias to run these two command in one.

php artisan serve

and

npm run watch

I tried :

alias test=php artisan serve &t npm run watch

also

alias test=php artisan serve && npm run watch

However as php artisan serve keeps running when executed it never runs the other command.

I was thinking about using a "new tab" command to run php artisan serve then run npm watch in a new tab, but i'm kind of lost in all this. Any help is greatly appreciated.

Thanks a lot as always.

0 likes
2 replies
Cruorzy's avatar

Serve just like watch are active processes, don't think you can run them within 1 window.. just make seperate aliases and them indeed in seperate windows

davidmcguiredesign's avatar

TLDR

Add a new startup task in ConEmu (titled whatever you want) and add the following in the commands box.

> -cur_console:t:PHP cmd /k ""%ConEmuDir%\..\init.bat" " && cd .. && php artisan serve

-cur_console:s1T50H -cur_console:t:Vite cmd /k ""%ConEmuDir%\..\init.bat" " && npm run watch

If you’re using ConEmu with Laragon*, check the "Default task for new console" box to run the task automatically when you click Laragon’s "Terminal" button. (Note that checking that box will uncheck whatever was previously set as the default startup task.)

Key realizations

(In sequence, not in order of importance)

  • -cur_console:t:PHP sets the title (:t) of the current console tab to whatever you put after a second colon (PHP, in this case).
  • Clicking "Active tabs" when editing a ConEmu Startup Task dumps the current tab configuration, including commands run in them, into the commands box.
  • Laragon sets the terminal’s working directory when it opens ConEmu.
  • The tab running Artisan will not run if it is not the active tab.

*Note that Laragon does provide a place to run commands: right click a blank space (in Laragon), then go to Laragon > usr > User.cmd. I’m not certain when precisely Laragon runs this file, or what commands it will take, but it would be more in keeping with Laragon’s way of doing things than setting up ConEmu directly.

Please or to participate in this conversation.