|
你们也是够懒的,稍稍改一下就可以了哐
刚好我也是刚做完,放在PE里,贴给你吧:
TFTPD32for WINDOWS\WINPE通用免配批处理CMD
@echo off
PUSHD %~dp0
SET TP=%CD%
rem ==========以下此行为启动引导文件,请自行修改=======
set bootfile=PXEgrldr.0
rem ==========================================================
if not exist %TP%\TFTPD32.EXE echo 当前目录下找不到文件:TFTPD32.EXE &&pause &&exit
echo 正在自动搜索启动文件,可能需要一些时间,请稍等。。。
set BaseDirectory=
set bootdrver=%~d0
if exist %bootdrver%\%bootfile% set BaseDirectory=%bootdrver%\&&goto copyfile
for /f "usebackq" %%i in (`dir "%bootdrver%\%bootfile%" /s/b`) do set BaseDirectory=%%~dpi
if %BaseDirectory%.==. echo 在 %bootdrver%盘上 找不到启动文件:%bootfile% &&pause
:copyfile
copy TFTPD*.*.* %temp% /y >nul
set TP=%temp%
PECMD FIND DHCP4NT.EXE,KILL DHCP4NT.EXE
set/a a=-2
for /f "usebackq tokens=2 delims=:" %%i in (`ipconfig`) do (
set b=%%i
call :getip
)
for /f "tokens=1-3,4 delims=." %%i in ("%_myip%") do set/a IP_Pool=100*256*256*256+%%k*256*256+%%j*256+%%i
for /f "tokens=1-3,4 delims=." %%i in ("%_mask%") do set/a mask=%%l*256*256*256+%%k*256*256+%%j*256+%%i
for /f "tokens=1-3,4 delims=." %%i in ("%_Gateway%") do set/a Gateway=%%l*256*256*256+%%k*256*256+%%j*256+%%i
>%TP%\TFTPD32.INI echo.[TFTPD32]
>>%TP%\TFTPD32.INI echo.
>>%TP%\TFTPD32.INI echo.Console Password=tftpd32
>>%TP%\TFTPD32.INI echo.TftpPort=69
>>%TP%\TFTPD32.INI echo.Negociate=1
>>%TP%\TFTPD32.INI echo.ShowProgressBar=1
>>%TP%\TFTPD32.INI echo.Timeout=3
>>%TP%\TFTPD32.INI echo.MaxRetransmit=6
>>%TP%\TFTPD32.INI echo.SecurityLevel=1
>>%TP%\TFTPD32.INI echo.UnixStrings=1
>>%TP%\TFTPD32.INI echo.Services=47
>>%TP%\TFTPD32.INI echo.PersistantLeases=1
>>%TP%\TFTPD32.INI echo.DHCP Ping=1
>>%TP%\TFTPD32.INI echo.Max Simultaneous Transfers=100
>>%TP%\TFTPD32.INI echo.BaseDirectory=%BaseDirectory%
>>%TP%\TFTPD32.INI echo.[DHCP]
>>%TP%\TFTPD32.INI echo.IP_Pool=%IP_Pool%
>>%TP%\TFTPD32.INI echo.PoolSize=100
>>%TP%\TFTPD32.INI echo.Gateway=%Gateway%
>>%TP%\TFTPD32.INI echo.Mask=%mask%
rem >>%TP%\TFTPD32.INI echo.DNS=%Gateway%
>>%TP%\TFTPD32.INI echo.BootFile=%bootfile%
start %TP%\TFTPD32.EXE
if not exist x:\*.* goto windows
PECMD.EXE LINK !%%DESKTOP%%\TFTPD32网络启动服务端,%TP%\TFTPD32.EXE
PECMD.EXE LINK !%%Programs%%\网络启动服务器\TFTPD32网络启动服务端,%TP%\TFTPD32.EXE
PECMD FILE "%%DESKTOP%%\开启HaneWin网络启动服务端.*"
PECMD FILE "%%DESKTOP%%\开启TFTPD32网络启动服务端.*"
rem 删除共享名PEroot,建立共享名为Peroot共享资源为%BaseDirectory%
PECMD EXEC CMD /C "net share PEROOT /d"
PECMD EXEC CMD /C "net share PEROOT=%BaseDirectory% /unlimited"
echo.
echo 已将本机光盘 %BaseDirectory% 共享给远程客户(\\Winpe\PEROOT,用户名:Guest,密码为空)
:windows
echo.
echo.
echo 远程启动网启服务器.启动成功!
pause
EXIT
:getip
set /a a=%a%+1
if %a%==1 set _myip=%b%
if %a%==2 set _mask=%b%
if %a%==3 set _Gateway=%b%
goto :eof
DHCP4NT for WINDOWS\WINPE通用免配批处理CMD
rem winPE\WINDOWS通用免配网启服务端.CMD
@echo off
PUSHD %~dp0
SET TP=%CD%
rem ==========以下此行为启动引导文件,请自行修改,启动文件与本cmd同分区即可=======
set bootfile=PXEgrldr.0
rem ==========================================================
if not exist %TP%\dhcp4nt.exe echo 当前目录下找不到文件:DHCP4NT.EXE &&pause &&exit
echo 正在自动搜索启动文件,可能需要一些时间,请稍等。。。
set BaseDirectory=
set bootdrver=%~d0
if exist %bootdrver%\%bootfile% set BaseDirectory=%bootdrver%\&&goto copyfile
for /f "usebackq" %%i in (`dir "%bootdrver%\%bootfile%" /s/b`) do set BaseDirectory=%%~dpi
if %BaseDirectory%.==. echo 在 %bootdrver%盘上 找不到启动文件:%bootfile% &&pause
:copyfile
copy DHCP*.* %temp% /y >nul
set tp=%temp%
%TP%\dhcp4nt.exe -remove >nul
setlocal
set/a a=-2
for /f "usebackq tokens=2 delims=:" %%i in (`ipconfig`) do (
set b=%%i
call :getip
)
for /f "tokens=1-3,4 delims=." %%i in ("%_myip%") do set IP_Pool=%%i.%%j.%%k.100
>%TP%\DHCPsrv.ini echo.[License]
>>%TP%\DHCPsrv.ini echo.Key=BBLZ26803UBBCAT9
>>%TP%\DHCPsrv.ini echo.Name=Free User
>>%TP%\DHCPsrv.ini echo.[DHCPsrv]
>>%TP%\DHCPsrv.ini echo.Profile0=本地连接
>>%TP%\DHCPsrv.ini echo.TFTPDirectory=%BaseDirectory%
>>%TP%\DHCPsrv.ini echo.Multicast=0
>>%TP%\DHCPsrv.ini echo.TFTPEnable=1
>>%TP%\DHCPsrv.ini echo.TFTPPort=69
>>%TP%\DHCPsrv.ini echo.TFTPMode=0
>>%TP%\DHCPsrv.ini echo.Log=0
>>%TP%\DHCPsrv.ini echo.TestIP=1
>>%TP%\DHCPsrv.ini echo.ChangeIP=1
>>%TP%\DHCPsrv.ini echo.EnableMAC=1
rem 有多个网卡时,如不能确定那个网卡,可以将下面此行去掉
>>%TP%\DHCPsrv.ini echo.Include=%_myip%
>>%TP%\DHCPsrv.ini echo.[本地连接]
>>%TP%\DHCPsrv.ini echo.SubnetMask=%_mask%
>>%TP%\DHCPsrv.ini echo.BaseIP=%IP_Pool%
>>%TP%\DHCPsrv.ini echo.Range=101
>>%TP%\DHCPsrv.ini echo.BootFile=%bootfile%
>>%TP%\DHCPsrv.ini echo.GatewayIP=%_Gateway%
>>%TP%\DHCPsrv.ini echo.InterfaceIP=%_myip%
endlocal
%tp%\dhcp4nt.exe -install >nul
start %tp%\dhcpsrv.cpl
if not exist x:\*.* goto windows
PECMD.EXE LINK !%%DESKTOP%%\HaneWin网启服务端,%tp%\dhcpsrv.cpl,,%tp%\dhcp.ico
PECMD.EXE LINK !%%Programs%%\网络启动服务器\开启HaneWin网络启动服务端,%tp%\dhcp4nt.exe,-install,shell32.dll#96
PECMD.EXE LINK !%%Programs%%\网络启动服务器\关闭HaneWin网络启动服务端,%tp%\dhcp4nt.exe,-remove,shell32.dll#95
PECMD.EXE LINK !%%Programs%%\网络启动服务器\HaneWin网启服务端,%tp%\dhcpsrv.cpl,,%tp%\dhcp.ico
PECMD FILE "%%DESKTOP%%\开启HaneWin网络启动服务端.*"
PECMD FILE "%%DESKTOP%%\TFTPD32网络启动服务端.*"
rem 删除共享名PEroot,建立共享名为Peroot共享资源为%BaseDirectory%
PECMD EXEC CMD /C "net share PEROOT /d"
PECMD EXEC CMD /C "net share PEROOT=%BaseDirectory% /unlimited"
rem PECMD FIND EXPLORER.EXE,KILL EXPLORER.EXE
echo.
echo 已将本机光盘 %BaseDirectory% 共享给远程客户(\\Winpe\PEROOT,用户名:Guest,密码为空)
:windows
echo.
echo.
echo 远程启动网启服务器.启动成功!
pause
EXIT
:getip
set /a a=%a%+1
if %a%==1 set _myip=%b%
if %a%==2 set _mask=%b%
if %a%==3 set _Gateway=%b%
goto :eof
本贴到此为止,保证不再更新!!!!!!!
[ 本帖最后由 歌理 于 2009-10-9 17:11 编辑 ] |
|