WinPE上网程序设置

时间:2016-09-23 13:28:49 

网启服务器自动配置程序:

@echo off

PUSHD %~dp0

SET TP=%CD%

Title HaneWin网启服务端 通用免配程序 for winPE_xp_03_win7

rem ==========以下此行为启动引导文件,请自行修改, 必须在分区根目录=======

set bootfile=PXEgrldr.0

rem ==========================================================

echo 正在自动搜索启动文件,可能需要一些时间,请稍等。。。

set BaseDirectory=

set bootdrver=%~d0

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:%bootfile% set bootdrver=%%i:

if not exist %bootdrver%%bootfile% ECHO 找不到网启文件:%bootfile% &&pause&& exit

set BaseDirectory=%bootdrver%

rem if exist %bootdrver%%bootfile% set BaseDirectory=%bootdrver%&&goto copyfile

rem for /f "usebackq" %%i in (`dir "%bootdrver%%bootfile%" /s/b`) do set BaseDirectory=%%~dpi

rem 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 %%Programs%%网络工具网启服务器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 FILE "%%DESKTOP%%开启HaneWin网启服务端.*"

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 已将本机PE系统 [url=file://%Computername%PEROOT]%Computername%PEROOT[/url] 共享给远程客户(主机名:%Computername%,用户名:Guest,密码为空)

:windows

echo.

echo.

echo 远程启动网启服务器.启动成功!可以进行远程网络启动PE!

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

===================================================================================

@ECHO OFF

Title HaneWin网启服务端_映射远程主机 免配程序 for winPE

PUSHD %~dp0

set tp=%cd%

rem 第一次运行

pecmd.exe IFEX %%Desktop%%映射远程主机.LNK,!EXEC cmd /c copy "%tp%网启快捷及映射主机.CMD" "%tp%映射远程主机.TMP"

PECMD.exe LINK %%Desktop%%映射远程主机,%tp%网启快捷及映射主机.CMD,,SHELL32.DLL#17

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:PEToolswin7.ini PECMD.exe file %%Desktop%%映射远程主机.*

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:外置程序winPE.ini PECMD.exe file %%Desktop%%映射远程主机.*

pecmd.exe IFEX %%Desktop%%映射远程主机.LNK,!EXEC cmd /c copy "%tp%网启快捷及映射主机.CMD" "%tp%映射远程主机.TMP"

if exist "%tp%映射远程主机.TMP" goto end

rem 映射远程主机

ipconfig /all |find /i "DHCP" |find /i "服务器">%temp%ip.txt

ipconfig /all |find /i "DHCP" |find /i "Server">>%temp%ip.txt

for /f "usebackq tokens=2 delims=:" %%i in (%temp%ip.txt) do (

set ip=%%i

)

set ip=%ip:~1%

ECHO.

ECHO 将远程服务器%ip%的共享名peroot 映射为本地Z:盘,主要是用于客户端,用户Guest,密码为空)

ECHO .

ECHO .

ECHO 正在连接至远程服务器:%ip%, 请稍等。。。。。。

ECHO.|NET USE z: [url=file://%ip%PEROOT]%ip%PEROOT[/url] /user:guest /persistent:no

pecmd wait 200

if exist z:*.* PECMD.EXE MESS 网络成功连接,并已连接远程服务器为Z:nnn如不能连上InterNet网,请在网络设置中释放-更新络IP,或在服务器上关闭网络启动服端!@提示 #ok *60000

if exist z:PETOOLSWin7.INI PECMD.EXE LINK %%Desktop%%加载远程外置程序1,PECMD.EXE,LOAD z:PETOOLSWin7.INI,Shell32.dll#46

if exist z:外置程序winPE.ini PECMD.EXE LINK %%Desktop%%加载远程外置程序2,PECMD.EXE,LOAD z:外置程序winPE.ini,Shell32.dll#46

if not exist z:*.* PECMD.EXE MESS 无法连接远程服务器,请检查网络或服务器!!@提示 #ok *60000

:end

pecmd.exe file "%tp%映射远程主机.TMP"

pecmd.exe file "%tp%映射远程主机.TMP"

pecmd.exe IFEX %%Desktop%%映射远程主机.LNK,!LINK %%Programs%%网络工具网启服务器HaneWin网启服务端,%tp%HaneWin网启服务端.CMD,,%tp%DHCP.ICO

exit

这段源码可以根据自己的需要进行适当修改。

看不过瘾?点击下面链接!
本站微信公众号:gsjx365,天天有好故事感动你!

相关电脑知识

美图欣赏

电脑知识排行榜