本帖最后由 idwma 于 2021-8-7 18:13 编辑
不清楚pe里bat是默认管理员权限运行的吗
弹框外面不能套括号改了一下- @echo off&setlocal enabledelayedexpansion
- chcp 437
- for /f "delims=" %%i in ('^(echo list disk ^)^|diskpart^|find "Online"') do set/a n+=1
- set/a n=!n!-1
- for /l %%i in (0,1,!n!) do ((echo select disk %%i &echo detail disk)|diskpart|findstr /i "volume.*no" &&set f=%%i)
- if not defined f start mshta vbscript:msgbox("没找到卷标为no的分区",0,"%提醒%")(window.close)&&exit
- for /l %%i in (0,1,!n!) do (
- for /f "tokens=2,3 delims= " %%a in ('^(echo select disk %%i ^&echo detail disk^)^|diskpart^|findstr /i "volume.*no"') do (
- if exist %%b:\window\system32 (
- (echo select disk %%i
- echo select volume %%a
- echo delete volume)|diskpart
- for /f "tokens=2 delims= " %%c in ('^(echo select disk %%i ^&echo list part^)^|diskpart^|findstr "system Reserved Recovery"') do (
- if not "%%c"=="" (
- (echo sel disk %%i
- echo sel part %%c
- echo del part override)|diskpart)
- )
- )
- )
- )
- pause
复制代码
|