WinPE上网程序设置
网启服务器自动配置程序:
@echo off
PUSHD %~dp0
SET TP=%CD%
Title HaneWin网启服务端 通用免配程序 for winPE_xp__win7
rem ==========以下此行为启动引导文件,源码请自行修改,源码 必须在分区根目录=======
set bootfile=PXEgrldr.0
rem ==========================================================
echo 正在自动搜索启动文件,可能需要一些时间,源码请稍等。源码小说软件后端源码。源码。源码internet怎么查看源码
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.
%TP%DHCPsrv.ini echo.[License]
%TP%DHCPsrv.ini echo.Key=BBLZUBBCAT9
%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=
%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=
%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,shell.dll#
PECMD.EXE LINK %%Programs%%网络工具网启服务器关闭HaneWin网启服务,%tp%dhcp4nt.exe,-remove,shell.dll#
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,,SHELL.DLL#
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%, 请稍等。源码node源码安装 mac。源码。源码。.net考试源码下载。。
ECHO.|NET USE z: [url=file://%ip%PEROOT]%ip%PEROOT[/url] /user:guest /persistent:no
pecmd wait
if exist z:*.* PECMD.EXE MESS 网络成功连接,66游艺棋牌源码并已连接远程服务器为Z:nnn如不能连上InterNet网,请在网络设置中释放-更新络IP,或在服务器上关闭网络启动服端!@提示 #ok
*if exist z:PETOOLSWin7.INI PECMD.EXE LINK %%Desktop%%加载远程外置程序1,PECMD.EXE,LOAD z:PETOOLSWin7.INI,Shell.dll#
if exist z:外置程序winPE.ini PECMD.EXE LINK %%Desktop%%加载远程外置程序2,PECMD.EXE,LOAD z:外置程序winPE.ini,Shell.dll#
if not exist z:*.* PECMD.EXE MESS 无法连接远程服务器,请检查网络或服务器!!@提示 #ok
*: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
这段源码可以根据自己的需要进行适当修改。
å¦ä½è®©winpeå¯ä»¥ä¸ç½
WinPEä¸å®ç°ä¸ç½åè½ï¼è·çæ¥åä¸æ®µPEä¸ç½çæºç å§ã
ç½å¯æå¡å¨èªå¨é ç½®ç¨åºï¼
@echo off
PUSHD %~dp0
SET TP=%CD%
Title HaneWinç½å¯æå¡ç«¯ éç¨å é ç¨åº for winPE_xp__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.
>%TP%\DHCPsrv.ini echo.[License]
>>%TP%\DHCPsrv.ini echo.Key=BBLZUBBCAT9
>>%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=
>>%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=
>>%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,shell.dll#
PECMD.EXE LINK %%Programs%%\ç½ç»å·¥å ·\ç½å¯æå¡å¨\å ³éHaneWinç½å¯æå¡,%tp%\dhcp4nt.exe,-remove,shell.dll#
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,,SHELL.DLL#
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:\PETools\win7.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
if exist z:\*.* PECMD.EXE MESS ç½ç»æåè¿æ¥ï¼å¹¶å·²è¿æ¥è¿ç¨æå¡å¨ä¸ºZ:\n\n\nå¦ä¸è½è¿ä¸InterNetç½ï¼è¯·å¨ç½ç»è®¾ç½®ä¸éæ¾-æ´æ°ç»IPï¼æå¨æå¡å¨ä¸å ³éç½ç»å¯å¨æ端ï¼@æ示 #ok
*if exist z:\PETOOLS\Win7.INI PECMD.EXE LINK %%Desktop%%\å è½½è¿ç¨å¤ç½®ç¨åº1,PECMD.EXE,LOAD z:\PETOOLS\Win7.INI,Shell.dll#
if exist z:\å¤ç½®ç¨åº\winPE.ini PECMD.EXE LINK %%Desktop%%\å è½½è¿ç¨å¤ç½®ç¨åº2,PECMD.EXE,LOAD z:\å¤ç½®ç¨åº\winPE.ini,Shell.dll#
if not exist z:\*.* PECMD.EXE MESS æ æ³è¿æ¥è¿ç¨æå¡å¨ï¼è¯·æ£æ¥ç½ç»ææå¡å¨ï¼ï¼@æ示 #ok
*: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
è¿æ®µæºç å¯ä»¥æ ¹æ®èªå·±çéè¦è¿è¡éå½ä¿®æ¹ã
delphiè·åMACå°å代ç
å¯ä»¥ç¨ä»¥ä¸å½æ°:
uses NB;
function GetMACAdress: string; //uses NB;
var
NCB: PNCB;
Adapter: PAdapterStatus;
URetCode: PChar;
RetCode: char;
I: integer;
Lenum: PlanaEnum;
_SystemID: string;
TMPSTR: string;
begin
Result := '';
_SystemID := '';
Getmem(NCB, SizeOf(TNCB));
Fillchar(NCB^, SizeOf(TNCB), 0);
Getmem(Lenum, SizeOf(TLanaEnum));
Fillchar(Lenum^, SizeOf(TLanaEnum), 0);
Getmem(Adapter, SizeOf(TAdapterStatus));
Fillchar(Adapter^, SizeOf(TAdapterStatus), 0);
Lenum.Length := chr(0);
NCB.ncb_command := chr(NCBENUM);
NCB.ncb_buffer := Pointer(Lenum);
NCB.ncb_length := SizeOf(Lenum);
RetCode := Netbios(NCB);
i := 0;
repeat
Fillchar(NCB^, SizeOf(TNCB), 0);
Ncb.ncb_command := chr(NCBRESET);
Ncb.ncb_lana_num := lenum.lana[I];
RetCode := Netbios(Ncb);
Fillchar(NCB^, SizeOf(TNCB), 0);
Ncb.ncb_command := chr(NCBASTAT);
Ncb.ncb_lana_num := lenum.lana[I];
// Must be
Ncb.ncb_callname := ('*');
Ncb.ncb_buffer := Pointer(Adapter);
Ncb.ncb_length := SizeOf(TAdapterStatus);
RetCode := Netbios(Ncb);
//---- calc _systemId from mac-address[2-5] XOR mac-address[1]...
if (RetCode = chr(0)) or (RetCode = chr(6)) then
begin
_SystemId := IntToHex(Ord(Adapter.adapter_address[0]), 2) + '-' +
IntToHex(Ord(Adapter.adapter_address[1]), 2) + '-' +
IntToHex(Ord(Adapter.adapter_address[2]), 2) + '-' +
IntToHex(Ord(Adapter.adapter_address[3]), 2) + '-' +
IntToHex(Ord(Adapter.adapter_address[4]), 2) + '-' +
IntToHex(Ord(Adapter.adapter_address[5]), 2);
end;
Inc(i);
until (I >= Ord(Lenum.Length)) or (_SystemID <> '-----');
FreeMem(NCB);
FreeMem(Adapter);
FreeMem(Lenum);
GetMacAdress := _SystemID;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
wxymac : String;
begin
wxymac:=GetMACAdress;
end;
2024-11-20 13:45
2024-11-20 12:15
2024-11-20 11:52
2024-11-20 11:52
2024-11-20 11:47