以下的程式碼,可以協助使用者編譯程式,像是原本要打nmake uefi64
只要直接打% vb
就可以啦,vb是variable build的簡稱啦~
若要執行nmake clean,可以打% vb clean
這裡要注意的是,在bat中,%是轉換為其它進位,真正餘數運算元是%%
以下是程式碼
vb.bat
@ECHO OFF
REM ========== GET THE START TIME (DO NOT MODIFY) ==========
SET StartTime=%time%
FOR /F "delims=:. tokens=1-3" %%p IN ("%StartTime%") DO (
SET /A StartTotalTime=%%p*60*60+%%q*60+%%r
)
REM ========== SET THE DEFAULT VALUE (DO NOT MODIFY) ==========
IF "%1" EQU "" (
SET TARGET=uefi64
) ELSE (
SET TARGET=%1
)
REM ========== EXECUTE NMAKE (DO NOT MODIFY) ==========
ECHO NMAKE %TARGET%
CALL NMAKE %TARGET%
@ECHO OFF
GOTO END
:END
REM ========== GET THE END TIME (DO NOT MODIFY) ==========
SET EndTime=%time%
FOR /F "delims=:. tokens=1-3" %%p IN ("%EndTime%") DO (
SET /A EndTotalTime=%%p*60*60+%%q*60+%%r
)
REM ========== Summary (DO NOT MODIFY) ==========
SET /A TotalTime=%EndTotalTime%-%StartTotalTime%
SET /A Hour=%TotalTime%/3600
SET /A Second=(%TotalTime%)%%60
SET /A Minute=(%TotalTime%-%Hour%*3600-%Second%)/60
ECHO Total: %Hour%:%Minute%:%Second% (From %StartTime% to %EndTime%)
REM ========== Jump the Hint Window (DO NOT MODIFY) ==========
cscript D:\Devtls\Bat\CompilerDoneMsg.vbs %TARGET% //Nologo
CompilerDoneMsg.vbs
If WScript.Arguments.Count() = 0 Then
MsgBox " CompilerDone ", vbSystemModal
Else
'
'Display first Argument only.
'
MsgBox " CompilerDone ", vbSystemModal, WScript.Arguments(0)
End If
參考資料:
如何用批處理求餘數
沒有留言:
張貼留言