- @echo off
- color 24
- del *txt
- for /f "tokens=2,3" %%a in (' "echo list disk | diskpart" ') do (
- if %%a==%%a set "num=%%a"
- )
- set /a "d=%num%"
- echo 有%d%个硬盘请确认
- set /a "f=%d%"-1
- for /l %%e in (0 1 %f%) do (
- partassist.exe /list:%e% /capacity /out:a.txt
- )
- for /f "skip=4 delims=|. tokens=2" %%p in (a.txt) do (
- echo %%p
- if %%p geq 60 goto aa
- if %%p lss 60 goto bb
-
- :aa ; 2分区方案
- echo 1
- pause
- goto eof
-
- :bb ;3分区方案
- echo 2
- pause
- goto eof
- )
复制代码 这段代码是用自动识别当前主机硬盘数目,用傲梅分区将硬盘容量输出到a.txt,然后用for读取a.txt里的内容获取硬盘容量并与60比较,然后跳转执行分区操作 |