|
这个是交互模式的,已经剔除了 Windows Boot Manager 的显示
- @echo off
- cls
- setlocal ENABLEDELAYEDEXPANSION
- if %1*==bcd* goto bcd
- :top
- cls
- echo.
- echo 删除 BOOTMGR BCD 启动项目
- echo.
- call :bcd
- echo.
- echo 请选择要删除的项目编号并回车确认(1.2.3.4...)_______
- echo Ctrl+C 中断脚本!
- echo.
- set/a p=0 && set /p p=
- if %p% EQU 99 GOTO end1
- if %p% LSS 1 GOTO ERROR1
- if %p% GTR %n% goto error1
- set /a p=%p%*3-2
- for /f "skip=%p% tokens=1,2" %%c in ('call %0 bcd') do (
- bcdedit /delete %%d
- echo 项目删除指令运行完毕!
- goto end1
- )
- :error1
- echo 输入错误,按任意键重来! && pause >nul
- goto top
- :bcd
- set n=0
- for /f "tokens=1,2*" %%c in ('bcdedit /v') do (
- if %%c*==标识符* (
- set /a n=!n!+1
- set "id= ID: %%d %%e"
- )
- if %%c*==description* (
- if not "%%d %%e"=="Windows Boot Manager" (
- echo ---!n!------------------------------------------------
- echo !id!
- echo 说明: %%d %%e
- ) else (set n=!n!-1)
- )
- )
- echo ---End--------------------------------------------------
- :end1
复制代码 |
|