admin管理员组文章数量:1432196
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.
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.
Share Improve this question asked Nov 19, 2024 at 11:55 roryrory 1,4384 gold badges26 silver badges52 bronze badges 4 |1 Answer
Reset to default 1Two problems.
- If you try to use
&&
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. - Both commands should use
CALL
, because if lessc is a batch file, it would otherwise not return to the caller
本文标签: cmdBatch file call lessc not returning control despite executing successfullyStack Overflow
版权声明:本文标题:cmd - Batch file call lessc not returning control despite executing successfully - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745563688a2663630.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
lessc
, that you try%% CALL "E:\Node\…
– Magoo Commented Nov 19, 2024 at 12:10&&
in a new line, then you must prefix it with a space. And the second line should also useCALL
– jeb Commented Nov 19, 2024 at 12:40CD "MVC\wwwroot
, the next line should read asCall webpack.cmd --config webpack.config.js --stats=summary
, then the next line as justCD styles
. You should also useE:\Node\lessc.cmd
too. e.g.Call "E:\Node\lessc.cmd" --glob --source-map --clean-css "style.less" "style.min.css" && Call "E:\Node\lessc.cmd" --glob --source-map --clean-css "style-below.less" "style-below.min.css"
. Then finallyCD ..\..\..
. – Compo Commented Nov 19, 2024 at 12:48