本帖最后由 ygqiang 于 2015-1-20 21:39 编辑
- :通用PE工具箱5.0-win7-64
- setlocal enabledelayedexpansion
-
- set tim=3
- set descri="通用PE工具箱5.0"
- set "bcdedit=%SystemRoot%\System32\bcdedit.exe"
- set "rar=C:\Program Files (x86)\WinRAR\WinRAR.exe"
-
- if not exist c:\8888 "%rar%" x -y "通用PE工具箱5.0.rar" c:\
-
- echo %bcdedit%
- %bcdedit% /v >list.txt
- %bcdedit% /enum >list1.txt
-
- %bcdedit% /timeout %tim%
-
-
-
-
- echo,赋值初始行指针
- set /a "nLine=0"
- echo,&echo,
-
- echo,查找符合条件总共有多少个节点
- set /a "nCount=0"
- for /f "delims=" %%i in ('findstr /i /r "通用.*PE" list.txt') do set /a "nCount+=1"
- echo,总共有 !nCount! 个节点符合要求
- echo,&echo,
-
- echo,设置查找次数标记
- set /a "nIndex=0"
- echo,&echo,
-
- :_start
- set /a "nIndex+=1"
- set "strID!nIndex!="
- for /f "tokens=1,2* delims=: " %%i in ('^(more +!nLine! list.txt^) ^| findstr /n /r "通用.*PE"') do (
- set /a "desLine=nLine+%%i"
- echo,当前发现符合条件描述在 : !desLine! 行
- set /a "nLine=desLine"
- echo,查到目标,更新行指针为 : !nLine!
- echo,完整描述内容为 : %%k
- echo,&echo,
-
- echo,从描述行前推4行,作为more的传入参数,作单循环处理便可查询当前节点的标识符
- set /a "desLine-=4"
- if !desLine! LSS 0 set /a "desLine=0"
-
- for /f "tokens=1,*" %%a in ('^(more +!desLine! list.txt^)^|findstr /i /r "标识符"') do (
- echo,查询当前节点的标识符为 : %%b
- set "strID!nIndex!=%%b"
- goto :next
- )
- )
- :next
- if !nIndex! LEQ !nCount! (
- echo,现在你已经得到标识符了,它存于变量strID!nIndex!里面,如果为空,则无符合条件
- call echo,strID!nIndex!值 : %%strID!nIndex!%%
- echo,==========================================&echo,&echo,
-
- REM 做你要做的事情
- REM Code here...
- REM 要做的事情结束
- call %bcdedit% /delete %%strID!nIndex!%%
-
- set /a "nLine+=1"
- echo,现在将行指针下移一行,继续开始查找符合条件项
- echo,新的行指针为 : !nLine!
- )
-
- if !nIndex! LEQ !nCount! goto :_start
-
-
-
-
-
- %bcdedit% /v >list2.txt
-
-
- :creatt
-
- %bcdedit% /create {777778af-66c9-4ad4-a54e-d76256db09e1} /application bootsector /d %descri%
- %bcdedit% /set {777778af-66c9-4ad4-a54e-d76256db09e1} device partition=C:
- %bcdedit% /set {777778af-66c9-4ad4-a54e-d76256db09e1} path \8888\PELOAD
- %bcdedit% /displayorder {777778af-66c9-4ad4-a54e-d76256db09e1} /addlast
-
- %bcdedit% /v >list3.txt
-
- cls
- ping 127.0.0.1 -n 1 >nul 2>nul
- del /f /q list*.txt
-
- 1pause&goto :EOF
复制代码
|