IF "%BootOS%"=="" ver|find /i " 5.2">nul &&SET BootOS=03
IF "%BootOS%"=="" ver|find /i " 6.1">nul &&SET BootOS=W7
:DHCP
rem 定义启动引导文件
IF "%1"=="" (
CLS
SET Choice=
Echo.
Echo 〖请问〗
Echo.
SET /P Choice=工作站要使用Grub方式启动吗?(Y/直接回车或其他键代表按默认的LINUX方式启动):
ECHO.
IF NOT "%Choice%"=="" SET Choice=%Choice:~0,1%
IF /I "%Choice%"=="y" SET PXEFN=grldr
) ELSE (
if "%PXEFN%"=="" PECMD.EXE LOAD %1\PXEFILE.INI
if "%PXEFN%"=="" For /F "tokens=3" %%i In ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V PXEFN^|find /I "PXEFN"') do SET PXEFN=%%i
)
IF "%PXEFN%"=="" SET PXEFN=pxelinux.0
IF EXIST %PR%\%PXEFN% goto FindBootFile
for %%i in (z y x w v u t s r q p o n m l k j i h g f e d c b a) do if exist %%i:\%PXEFN% set TFTPROOT=%%i:\&&goto FindBootFile
仔细研读了楼主的命令,才发现原来是这样计算DNS地址的,原来0PE里的tftp32配置文件也有这些命令,一时没仔细研读
现在终于搞定了DNS地址了
call :getip
)
for /f "tokens=1-4 delims=." %%i in ("%mydns%") do set/a DnsServer=%%l*256*256*256+%%k*256*256+%%j*256+%%i
:getip
ipconfig /all>>_ipconfig.txt
set offset=
for /f "usebackq tokens=3 delims=[" %%i in (`ver^|find /i "["`) do set myver=%%i&&echo %myver%
echo %myver%
for /f "usebackq tokens=1" %%i in (`str _ipconfig.txt 0 0 /f /asc:本地连接^|find "["`) do set offset=%%i
if "%offset%"=="" for /f "usebackq tokens=1" %%i in (`str _ipconfig.txt 0 0 /f /asc:Local Area Connection^|find "["`) do set offset=%%i
if "%offset%"=="" goto L1
for /f "usebackq tokens=2 delims=:" %%i in (`type _ipconfig.txt^|find /i "DNS Servers"`) do set mydns=%%i&&goto :L5
:L1
if "%mydns%"=="" set mydns= 0.0.0.0
if "%mydns%"==" " set mydns= 0.0.0.0