|
mdyblog 发表于 2013-7-14 05:32
把 安装 驱动那段代码 贴出来看看。
就是最简单的UPNP -pnp啊。
要是看全码那就多了,很多其实跟PECMD也没关。
正常来说,就是下面几句:
PECMD.EXE DEVI $DRIVERS_NET.CAB
START /Wait x:\wxpe\system32\InfCacheBuild.exe %SystemRoot%
PECMD.EXE UPNP -pnp
……
全部的话:
@echo off
PUSHD %~dp0
PECMD ENVI
SET HK_ENV=HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
IF "%BootOS%"=="xp" ver|find /i " 5.2">nul &&SET BootOS=03
IF "%IniDrv%"=="" For /F "tokens=3" %%i In ('REG QUERY "%HK_ENV%" /V IniDrv^|find /I "IniDrv"') do SET IniDrv=%%i
IF "%1"=="NET" GOTO INST_NIC
IF /I "%1"=="WLAN" GOTO INST_NIC
IF /I "%1"=="DHCP" GOTO DHCP
IF /I "%1"=="PPPOE" GOTO PPPOE
EXIT
:INST_NIC
PECMD TIPS 正在驱动网卡,请稍候....,5000,1,%ProgramFiles%\tools\ico.DLL#18
IF /I "%1"=="WLAN" SET CM_NET=2
IF NOT EXIST %WinDir%\System32\PENetCfg.exe (
ECHO 正在释放网络支持文件.......
7z.exe x "NET_PART%BootOS%.7z" -y -aos -o"%WinDir%"
)
IF "%CM_NET%"=="2" (
ECHO.
ECHO 正在安装无线网卡驱动.......
ECHO.
PECMD TIPS 正在驱动网卡,正在安装无线网卡驱动....,5000,1,%ProgramFiles%\tools\ico.DLL#18
PECMD.EXE DEVI $DRIVERS_NET_WIRELESS.CAB
ECHO.>"%WinDir%\LD_NET_WAN.OK"
) ELSE (
ECHO.
ECHO 正在安装有线网卡驱动.......
ECHO.
PECMD TIPS 正在驱动网卡,正在安装有线网卡驱动....,5000,1,%ProgramFiles%\tools\ico.DLL#18
PECMD.EXE DEVI $DRIVERS_NET.CAB
ECHO.>"%WinDir%\LD_NET_LAN.OK"
PECMD.EXE PXEFILE.INI
)
START /Wait x:\wxpe\system32\InfCacheBuild.exe %SystemRoot%
PECMD.EXE UPNP -pnp
NET START EVENTLOG
if "%PXEFN%"=="" For /F "tokens=3" %%i In ('REG QUERY "%HK_ENV%" /V PXEFN^|find /I "PXEFN"') do SET PXEFN=%%i
if "%PXEFN%"=="" (PECMD.EXE UPNP -pnp -cn PEWS-* -wg WORKGROUP) ELSE PECMD.EXE UPNP -pnp -cn WINPE -wg WORKGROUP
PECMD.EXE UPNP -c p -i MS_TCPIP
PECMD.EXE UPNP -c c -i MS_MSCLIENT
PECMD.EXE UPNP -c s -i MS_SERVER
NET START TCPIP
NET START DHCP
NET START NLA
rem NET START LMHOSTS
SET K=HKLM\SYSTEM\CurrentControlSet\Services&&SET W=AutoShareServer&&SET S=AutoShareWks
REG ADD %K%\Lanmanserver\parameters /v %S% /t REG_DWORD /d 0 /f
REG ADD %K%\Lanmanserver\parameters /v %W% /t REG_DWORD /d 0 /f
REG ADD %K%\lanmanworkstation\parameters /v %S% /t REG_DWORD /d 0 /f
REG ADD %K%\lanmanworkstation\parameters /v %W% /t REG_DWORD /d 0 /f
IF "%CM_NET%"=="2" (
PECMD.EXE UPNP -v -c p -i MS_NDISUIO
PECMD.EXE UPNP -v -c s -i MS_WZCSVC
NET START WZCSVC
)
NET START SERVER
DEL /Q %SystemRoot%\INF\*.PNF %SystemRoot%\INF\INFCACHE.1
For /F "tokens=3" %%i In ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /V ComputerName') do SET ComputerName=%%i
REG ADD "%HK_ENV%" /v ComputerName /t REG_SZ /d "%Computername%" /f
REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /va /f >nul
REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /va /f >nul
IPCONFIG >nul
FOR /F %%i IN ('@reg query "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}" /s^|find /i "Connection"') DO >nul REG ADD %%i /v ShowIcon /t REG_DWORD /d 1 /f &&SET ShowIcon=1
IF #%ShowIcon%==#1 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /f /v "{208D2C60-3AEA-1069-A2D7-08002B30309D}" /t REG_DWORD /d 0
NET USER Administrator tangope
NET USER Guest /active:yes
NET USER Guest /passwordreq:no
IF "%CM_NET%"=="2" GOTO LINK
IF "%HOSTIP%"=="" For /F "tokens=3" %%i In ('REG QUERY "%HK_ENV%" /V HOSTIP^|find /I "HOSTIP"') do SET HOSTIP=%%i
IF "%HOSTIP%"=="" GOTO SETIP_FROM_IPSET
REM 从注册表中取前面定义的IP地址
SET myIP=%HOSTIP%
SET myMASK=255.255.255.0
For /F "tokens=1,2,3 delims=." %%i In ("%HOSTIP%") do SET myGATEWAY=%%i.%%j.%%k.1
SET myDNS=%myGATEWAY%
GOTO SETIP
:SETIP_FROM_IPSET
IF NOT EXIST %IniDir%\IPSET.INI GOTO LINK
REM 从注册表中取前面定义的IP地址
PECMD TEXT 正在读取固定IP定义文件%IniDir%\IPSET.INI……#0xFF L200 T100 R600 B400 $18
For /F "eol=; tokens=2 delims=^=" %%i In ('find /I ^"IP地址^" %IniDir%\IPSET.INI') do SET myIP=%%i
For /F "eol=; tokens=2 delims=^=" %%i In ('find /I ^"子网掩码^" %IniDir%\IPSET.INI') do SET myMASK=%%i
For /F "eol=; tokens=2 delims=^=" %%i In ('find /I ^"默认网关^" %IniDir%\IPSET.INI') do SET myGATEWAY=%%i
For /F "eol=; tokens=2 delims=^=" %%i In ('find /I ^"DNS^" %IniDir%\IPSET.INI') do SET myDNS=%%i
PECMD TEXT 从文件%IniDir%\IPSET.INI读取的IP设置如下:\n\n IP 地址=%myIP%\n 子网掩码=%myMASK%\n 默认网关=%myGATEWAY%\n DNS=%myDNS% \n\n系统正在按上述值设置固定IP.....#0xFF L200 T100 R600 B400 $18
:SETIP
net stop dhcp 1>nul
rundll32 netshell.dll HrRenameConnection 1>nul
netsh add helper ifmon.dll 1>nul
netsh interface ip set address name="本地连接" source=static addr=%myIP% mask=%myMASK% 1>nul
netsh interface ip set address name="本地连接" gateway=%myGATEWAY% gwmetric=0 1>nul
netsh interface ip set dns name="本地连接" source=static addr=%myDNS% register=PRIMARY 1>nul
net start dhcp 1>nul
:LINK
PECMD TEXT
PECMD.EXE LINK %QuickLaunch%\PENETCFG 网络设置,%SystemRoot%\System32\PENETCFG.exe
PECMD.EXE LINK %USERPROFILE%\「开始」菜单\程序\系统设备\网络设置\网络设置 PENETCFG,%SystemRoot%\System32\PENETCFG.exe
PECMD.EXE LINK !%USERPROFILE%\「开始」菜单\程序\系统设备\网络设置\启用宽带连接,%CD%\START_NET.CMD,PPPOE,shell32.dll#17
PECMD.EXE LINK !%USERPROFILE%\「开始」菜单\程序\系统设备\网络设置\安装 HaneWin 网启服务,%CD%\START_NET.CMD,DHCP,shell32.dll#17
IF "%CM_NET%"=="2" GOTO END
IF "%PXEFN%"=="" GOTO END
:DHCP
REM 设置HAneWin DHCP-----------------
if "%PXEFN%"=="" For /F "tokens=3" %%i In ('REG QUERY "%HK_ENV%" /V PXEFN^|find /I "PXEFN"') do SET PXEFN=%%i
IF "%PXEFN%"=="" SET PXEFN=grldr
IF EXIST %IniDrv%\%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 IniDrv=%%i:&&GOTO FindBootFile
PECMD.EXE MESS 不存在网启文件:%IniDrv%\%PXEFN%,请准备好该文件后后再运行本程序!@提示:缺少网启文件 #OK *10000
GOTO END
:FindBootFile
IF NOT EXIST %WinDir%\System32\dhcpsrv.cpl 7z.exe x DHCP.7z -y -aos -o"%WinDir%\System32"
For /F "tokens=3" %%i In ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /V ComputerName') do SET ComputerName=%%i
setlocal
for /f "usebackq tokens=2 delims=[]" %%i in (`ping /n 1 %Computername%`) do set myip=%%i
for /f "tokens=1-3,4 delims=." %%i in ("%myip%") do set mynet=%%i.%%j.%%k
>%WinDir%\System32\DHCPsrv.ini echo.[License]
>>%WinDir%\System32\DHCPsrv.ini echo.Key=BBLZ26803UBBCAT9
>>%WinDir%\System32\DHCPsrv.ini echo.Name=Free User
>>%WinDir%\System32\DHCPsrv.ini echo.[DHCPsrv]
>>%WinDir%\System32\DHCPsrv.ini echo.Profile0=本地连接
>>%WinDir%\System32\DHCPsrv.ini echo.Include=%myip%
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPDirectory=%IniDrv%\
>>%WinDir%\System32\DHCPsrv.ini echo.Multicast=0
>>%WinDir%\System32\DHCPsrv.ini echo.TestIP=1
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPEnable=1
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPMode=0
>>%WinDir%\System32\DHCPsrv.ini echo.Log=0
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPWindowSize=1
>>%WinDir%\System32\DHCPsrv.ini echo.[本地连接]
>>%WinDir%\System32\DHCPsrv.ini echo.SubnetMask=255.255.255.0
>>%WinDir%\System32\DHCPsrv.ini echo.BaseIP=%mynet%.100
>>%WinDir%\System32\DHCPsrv.ini echo.Range=101
>>%WinDir%\System32\DHCPsrv.ini echo.NextIP=%myip%
>>%WinDir%\System32\DHCPsrv.ini echo.BootFile=%PXEFN%
>>%WinDir%\System32\DHCPsrv.ini echo.RootPath=
>>%WinDir%\System32\DHCPsrv.ini echo.UseOpt=0
>>%WinDir%\System32\DHCPsrv.ini echo.DNSUpdate=0
>>%WinDir%\System32\DHCPsrv.ini echo.InterfaceIP=%myip%
dhcp4nt.exe -install
endlocal
set ExtDrv=%IniDrv%
net share PEROOT /d >nul 2>nul
IF "%BootOS%"=="xp" (
net share PEROOT=%ExtDrv%\ /unlimited
) ELSE net share PEROOT=%ExtDrv%\ /grant:Guest,full /unlimited
rem icacls %ExtDrv%\ /t /grant everyone:f
PECMD LINK %USERPROFILE%\「开始」菜单\程序\系统设备\网启服务器\HaneWin 网启服务端,dhcpsrv.cpl,,dhcp.ico
PECMD LINK %USERPROFILE%\「开始」菜单\程序\系统设备\网启服务器\中止 HaneWin 网启服务,dhcp4nt.exe,-remove,shell32.dll#2
PECMD LINK %USERPROFILE%\「开始」菜单\程序\系统设备\网启服务器\重启 HaneWin 网启服务,dhcp4nt.exe,-install,shell32.dll#9
START dhcpsrv.cpl
GOTO END
:PPPOE
IF NOT Exist "%SystemRoot%\SYSTEM32\RASPHONE.PBK" (
ECHO 正在释放拨号组件.......
7z.exe x PPPOE%BootOS%.7z -y -aos -o"%SystemRoot%\SYSTEM32"
)
PECMD.EXE UPNP -c p -i MS_L2TP
PECMD.EXE UPNP -c p -i MS_PPTP
PECMD.EXE UPNP -c p -i MS_PPPOE
START %SystemRoot%\SYSTEM32\RASPHONE.PBK
PECMD.EXE UPNP -c p -i MS_WANARP
PECMD.EXE UPNP -c p -i MS_NDISWAN
PECMD.EXE UPNP -c s -i MS_RASCLI
PECMD.EXE UPNP -c s -i MS_RASSRV
PECMD.EXE UPNP -c s -i MS_RASMAN
PECMD.EXE UPNP -c s -i MS_STEELHEAD
PECMD.EXE SERV TAPISRV
PECMD.EXE SERV RASMAN
PECMD.EXE SERV NETMAN
PECMD.EXE LINK %USERPROFILE%\「开始」菜单\程序\系统设备\网络设置\宽带连接,%SystemRoot%\SYSTEM32\RASPHONE.PBK
PECMD.EXE LINK !%USERPROFILE%\「开始」菜单\程序\系统设备\网络设置\挂断ADSL,%SystemRoot%\System32\HANGUP.CMD,,HANGUP.ICO
DEL /Q "%Programs%\系统设备\网络设置\启用宽带连接.LNK"
ECHO.>"%WinDir%\LD_NET_PPP.OK"
EXIT
:End
START /B penetcfg.exe
PECMD LOAD %SystemRoot%\System32\reshell.ini
EXIT
|
|