0
以下是程序應該作爲VS中的預生成事件運行。它直接從命令行工作,但不在VS中。Visual Studio和cmd.exe如何以及爲什麼以不同方式處理批處理文件
@echo off
:: Direct From cmd.exe
:: "G:Google Drive\GitHub\toolset\Site\pre-build.bat" Release "G:Google Drive\GitHub\toolset\Site\Web"
:: From Visual Studio Pre-Build Event
:: "$(SolutionDir)pre-build.bat" $(ConfigurationName) "$(ProjectDir)"
if %1==Release (
if exist %2 (
set location=%2
set dotlessVersion=v1.3.1.0
:: Compress Less Files
for /r %location% %%a in (*.less) do (
"%~dp0..\SharedLibs\dotless\%dotlessVersion%\dotless.Compiler.exe" -m -r "%%a" "%%~da%%~pa%%~na.min.css"
)
:: Minify js Files
for /r %location% %%a in (*.closure.js) do (
set newFilename=%%a
call java -jar "%~dp0..\SharedLibs\Closure Compiler\compiler.jar" --js "%%a" --js_output_file "%%newFilename:.closure.js=.min.js%%"
)
)
)
它爲什麼不起作用?怎麼了?你在輸出窗口中看到了什麼? – SLaks
輸出窗口中不顯示任何內容。如果我在'set location =%2'之後添加'echo Value:%location%',則輸出爲'Value:'。 cmd.exe將該變量輸出到回顯中。 – roydukkey