|
管理员权限运行,否则无法卸载盘符
- @echo off
- pushd %~dp0
- for /f "skip=21 tokens=1,3 delims=:\ " %%a in ('mountvol') do if "%%a"=="EFI" set "espltr=%%b"
- if not defined espltr for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D) do if not exist %%a:\ set "espltr=%%a"&&goto next
- :next
- if not exist %espltr%:\ mountvol %espltr%: /s >nul
- if exist %espltr%:\ (
- echo;ESP 分区 %espltr%,执行ESP相关代码...
- ping -n 3 127.1
- mountvol %espltr%: /d
- ) else (
- echo;不存在ESP分区,执行C盘相关代码...
- )
- pause
复制代码 |
|