1.å¦ä½è®©winpeå¯ä»¥ä¸ç½
å¦ä½è®©winpeå¯ä»¥ä¸ç½
WinPEä¸å®ç°ä¸ç½åè½ï¼è·çæ¥åä¸æ®µPEä¸ç½çæºç å§ã
ç½å¯æå¡å¨èªå¨é ç½®ç¨åºï¼
@echo off
PUSHD %~dp0
SET TP=%CD%
Title HaneWinç½å¯æå¡ç«¯ éç¨å é ç¨åº for winPE_xp__win7
rem ==========以ä¸æ¤è¡ä¸ºå¯å¨å¼å¯¼æ件ï¼è¯·èªè¡ä¿®æ¹,源码c 程序源码 å¿ é¡»å¨ååºæ ¹ç®å½ï¼ï¼ï¼ï¼ï¼ï¼ï¼
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
è¿æ®µæºç å¯ä»¥æ ¹æ®èªå·±çéè¦è¿è¡éå½ä¿®æ¹ã