makeit.bat

来自「我java遍的一个运行程序」· Batch 代码 · 共 121 行

BAT
121
字号
@echo off

if exist %1.rc goto namerc
if exist rsrc.rc goto rsrc

: -------------------------------
:rsrc
: -------------------------------
: if resources exist, build them
: -------------------------------
if not exist rsrc.rc goto over1
\MASM32\BIN\Rc.exe /v rsrc.rc
\MASM32\BIN\Cvtres.exe /machine:ix86 rsrc.res
:over1

if exist %1.obj del %1.obj
if exist %1.exe del %1.exe

: -----------------------------------------
: assemble %1.asm into an OBJ file
: -----------------------------------------
\MASM32\BIN\Ml.exe /c /coff %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

: --------------------------------------------------
: link the main OBJ file with the resource OBJ file
: --------------------------------------------------
\MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS %1.obj rsrc.obj
if errorlevel 1 goto errlink
dir %1.*
goto TheEnd

:nores
: -----------------------
: link the main OBJ file
: -----------------------
\MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS %1.obj
if errorlevel 1 goto errlink
dir %1.*
goto TheEnd

:errlink
: ----------------------------------------------------
: display message if there is an error during linking
: ----------------------------------------------------
echo.
echo There has been an error while linking this %1.
echo.
goto TheEnd

:errasm
: -----------------------------------------------------
: display message if there is an error during assembly
: -----------------------------------------------------
echo.
echo There has been an error while assembling this %1.
echo.
goto TheEnd

: -------------------------------
:namerc
: -------------------------------
: if resources exist, build them
: -------------------------------
if not exist %1.rc goto over2
\masm32\bin\rc.exe /v %1.rc
: \masm32\bin\cvtres.exe /machine:ix86 %1.res
:over2

if not exist %1.rc goto nores2
if exist %1.obj del %1.obj
if exist %1.exe del %1.exe

: -----------------------------------------
: assemble %1.asm into an obj file
: -----------------------------------------
\masm32\bin\ml.exe /c /coff /Cp %1.asm
if errorlevel 1 goto errasm2

if not exist %1.obj goto nores2

: --------------------------------------------------
: link the main obj file with the resource obj file
: --------------------------------------------------
\masm32\bin\link.exe /subsystem:windows %1.obj %1.res
if errorlevel 1 goto errlink2
dir %1.*
goto TheEnd

:nores2
: -----------------------
: link the main obj file
: -----------------------
\masm32\bin\link.exe /subsystem:windows %1.obj
if errorlevel 1 goto errlink2
dir %1.*
goto TheEnd

:errlink2
: ----------------------------------------------------
: display message if there is an error during linking
: ----------------------------------------------------
echo.
echo There has been an error while linking this %1.
echo.
goto TheEnd

:errasm2
: -----------------------------------------------------
: display message if there is an error during assembly
: -----------------------------------------------------
echo.
echo There has been an error while assembling this %1.
echo.
goto TheEnd

:TheEnd

pause

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?