I have this batch file but can't get it to return control after chaining commands:
set hostingDir=%cd%
cd "%hostingDir%\MVC\wwwroot
call webpack --config webpack.config.js --stats=summary
cd "%hostingDir%\MVC\wwwroot\styles"
REM Compile LESS files
call "E:\Node\lessc" --glob --source-map --clean-css "style.less" "style.min.css"^
&& "E:\Node\lessc" --glob --source-map --clean-css "style-below.less" "style-below.min.css"
REM Return to base directory -- don't get to here
cd %hostingDir%
PAUSE
However, if I remove the chaining and call lessc on only either of the 2 less files, the entire script executes. So I know there is nothing wrong with the less files themselves. I deleted the compiled files and ran again to make sure they compile and they do. Even with both commands chained together.
Two problems.
&&
in a new line, you must prefix it with a space, otherwise the first &
will be escaped and the second command will be executed unconditionally.CALL
, because if lessc is a batch file, it would otherwise not return to the caller