What I need?
Run 3 commands from 1 batch script, and terminate them all with ctrl+c:
sass -w styles/scss/main.scss:styles/css/main.css --style compressed --no-cache
grunt watch
php -S 127.0.0.1:8081
What I tried:
start /b "sass -w styles/scss/main.scss:styles/css/main.css --style compressed --no-cache"
start /b "grunt watch"
start /b "php -S 127.0.0.1:8081"
And:
start /b "sass -w styles/scss/main.scss:styles/css/main.css --style compressed --no-cache"
start /b "grunt watch"
start /b "php -S 127.0.0.1:8081"
And:
start /b cmd /c "sass -w styles/scss/main.scss:styles/css/main.css --style compressed --no-cache"
start /b cmd /c "grunt watch"
start /b cmd /c "php -S 127.0.0.1:8081"
This one doesn't work, but I can only terminate Sass. When "grunt watch" hits - no longer able to terminate it.
Grunt:
> where grunt
> C:\Users\%USERNAME%\AppData\Local\scoop\apps\nodejs\0.12.0\nodejs\grunt
> C:\Users\%USERNAME%\AppData\Local\scoop\apps\nodejs\0.12.0\nodejs\grunt.cmd
> type C:\Users\%USERNAME%\AppData\Local\scoop\apps\nodejs\0.12.0\nodejs\grunt.cmd
> @IF EXIST "%~dp0\node.exe" (
> "%~dp0\node.exe" "%~dp0\node_modules\grunt-cli\bin\grunt" %*
> ) ELSE (
> @SETLOCAL
> @SET PATHEXT=%PATHEXT:;.JS;=;%
> node "%~dp0\node_modules\grunt-cli\bin\grunt" %*
>)
Sass:
> where sass
> C:\Users\%USERNAME%\AppData\Local\scoop\apps\ruby\2.1.5\bin\sass.bat
> type C:\Users\%USERNAME%\AppData\Local\scoop\apps\ruby\2.1.5\bin\sass.bat
> @ECHO OFF
> IF NOT "%~f0" == "~f0" GOTO :WinNT
> @"ruby.exe" "C:/Users/%USERNAME%/AppData/Local/scoop/apps/ruby/2.1.5/bin/sass" %1 %2 %3 %4 %5 %6 %7 %8 %9
> GOTO :EOF
> :WinNT
> @"ruby.exe" "%~dpn0" %*
I also found this: Powershell: Run multiple jobs in parralel and view streaming results from background jobs
But it's: 1. PowerShell, not plain cmd.exe 2. Too difficult for me to understand.
But still, if cmd isn't capable of running 3 cmds at once, I might switch to PowerShell. So PS solutions are acceptable too.
Thank you.
UPD
Just for clarification. In bash I do traps: https://stackoverflow.com/a/3414377/898099 . And I get the logs with them. Need the same for windows.