echo [on or off] [message]
這個指令是要把訊息,丟到螢幕上。
set [[/a [expression]] [/p [variable=]] string]
設定一個環境變數
call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]]
可呼叫另一個批次檔
%name
變數代表的值
%name%
變數的內容值
:Label
在批次檔常被用來做跳躍的點
if NOT "%i1%"=="123" goto go1
如果不等於的跳躍
if "%i1%"=="123" goto go1
如果等於的跳躍
範例:
下面的範例"GenAll.bat"批次檔,會去呼叫"GenImage.dat",去執行產生一些檔案。
-----------------------------------------GenAll.bat--------------------------------------------------
set packagename="Release_92xx"
set batfile="GenImage"
del %packagename% /s/q
rd %packagename% /s/q
mkdir %packagename%
cd %packagename%
copy ..\%batfile%.dat .\%batfile%.bat
mkdir CpuAHCI
mkdir CpuIDE
mkdir PassAHCI
echo "========CPU AHCI MODE========"
set modetype=Cpu
set classtype=AHCI
set idfolder=9220
call %batfile%
set modetype=Cpu
set classtype=AHCI
set idfolder=9230
call %batfile%
set modetype=Cpu
set classtype=AHCI
set idfolder=9236
call %batfile%
set modetype=Cpu
set classtype=AHCI
set idfolder=generic
call %batfile%
echo "========CPU IDE MODE========"
set modetype=Cpu
set classtype=IDE
set idfolder=922A
call %batfile%
set modetype=Cpu
set classtype=IDE
set idfolder=923A
call %batfile%
echo "========Pass AHCI MODE========"
set modetype=Pass
set classtype=AHCI
set idfolder=9225
call %batfile%
set modetype=Pass
set classtype=AHCI
set idfolder=9235
call %batfile%
set modetype=Pass
set classtype=AHCI
set idfolder=generic
call %batfile%
del %batfile%.bat
echo "========END========"
pause
-----------------------------------------GenImage.dat--------------------------------------------------
cd %modetype%%classtype%
mkdir %idfolder%
cd %idfolder%
rem copy /d /y ..\..\..\Mvflash\* .
xcopy ..\..\..\Mvflash\* . /e
cd bin
mkdir Image_Creator
cd Image_Creator
xcopy ..\..\..\..\..\Image_Creator\* . /e
copy ..\..\..\..\..\config\%modetype%_config.txt config.txt
if NOT "%idfolder%"=="generic" goto genericskip
copy ..\..\..\..\..\bios\multiPNPimage\bios.bin .
copy ..\..\..\..\..\autoload\%modetype%%classtype%\%idfolder%\autoload.bin .
goto genericend
:genericskip
copy ..\..\..\..\..\bios\singlePNPimage\%classtype%\%idfolder%b.bin bios.bin
copy ..\..\..\..\..\autoload\%modetype%%classtype%\%idfolder%\autoload.bin .
:genericend
if NOT "%modetype%"=="Cpu" goto cpuskip
copy ..\..\..\..\..\firmware\* .
copy ..\..\..\..\..\loader\* .
:cpuskip
imgCreate.exe
copy image ..\
cd ..\..\..\..\
沒有留言:
張貼留言