『第 2 楼』:
使用 LLM 解释/回答一下
echo 输入各分区大小(单位:GB),空格或","分开,最后一个分区不输:
set size=
Set /P size=各分区大小:
echo.
::从这里开始注释;
echo 输入"NTFS"或"FAT"进行相应格式化,输入"N"或省略则不格式化:
::删除 frmt 变量
set frmt=
::用户输入 frmt 变量值( NTFS or FAT )
Set /P frmt=:
::删除 frmt 变量
set frmty=
:: 下面的 if 语句是设定 frmty 和 ss 变量值.
:: 其中 frmty 变量保存 Gdisk32 的参数
:: /for 为格式化分区; /q 就是快速格式化 /ntfs 指定分区格式
:: 两种分区格式的算法不同。ss 变量是保存基数。 在下面会用到
If /I '%frmt%'=='ntfs' set frmty=/for /q /ntfs&&set ss=1024
If /I '%frmt%'=='fat' set frmty=/for /q&&set ss=1028-8
echo 开始分区,稍等...
echo 分区过程信息:
::将用户输入的每个分区大小值取出,最多可设定9个分区
for /f "tokens=1,2,3,4,5,6,7,8,9 delims=, " %%c in ("%size%") do (
rem 下面将用户输入的分区大小数( GB单位 ) 转化为 MB 单位。就是 数值* SS变量值
rem 例如 NTFS 分区则是: GB数值*1024
set /A cp=%%c*%ss%
rem 下面两行划分第一个主分区并激活
GDISK32 1 /cre /pri /sz:!cp! %frmty%
GDISK32 1 /act /p:1
rem 下面一行将剩余空间划分为扩展分区
GDISK32 1 /cre /ext
rem 下面的 For 循环是划分逻辑分区。 最多八个
for %%i in (%%d,%%e,%%f,%%g,%%h,%%i,%%j,%%k) do (
set /A op=%%i*%ss%
GDISK32 1 /cre /log /sz:!op! %frmty%
))
::将剩余空间划分为一个逻辑分区
GDISK32 1 /cre /log /end %frmty%
echo.
echo 分区完成!
Last edited by wewebb on 2010-11-20 at 14:28 ]
echo Enter the size of each partition (unit: GB), separated by spaces or commas, and do not enter the last partition:
set size=
Set /P size=Partition sizes:
echo.
::Comment starts from here;
echo Enter "NTFS" or "FAT" to format accordingly, enter "N" or omit to not format:
::Delete the frmt variable
set frmt=
::User enters the value of the frmt variable (NTFS or FAT)
Set /P frmt=:
::Delete the frmt variable
set frmty=
:: The following if statement is to set the values of frmty and ss variables.
:: Among them, the frmty variable stores the parameters of Gdisk32
:: /for is to format the partition; /q is quick format /ntfs specifies the partition format
:: The algorithms for the two partition formats are different. The ss variable stores the base number. It will be used below
If /I '%frmt%'=='ntfs' set frmty=/for /q /ntfs&&set ss=1024
If /I '%frmt%'=='fat' set frmty=/for /q&&set ss=1028-8
echo Starting partitioning, please wait...
echo Partition process information:
::Take out each partition size value entered by the user, up to 9 partitions can be set
for /f "tokens=1,2,3,4,5,6,7,8,9 delims=, " %%c in ("%size%") do (
rem Convert the partition size value entered by the user (GB unit) to MB unit. That is, numerical value * SS variable value
rem For example, for NTFS partition: GB value * 1024
set /A cp=%%c*%ss%
rem The following two lines divide the first primary partition and activate
GDISK32 1 /cre /pri /sz:!cp! %frmty%
GDISK32 1 /act /p:1
rem The following line divides the remaining space into extended partitions
GDISK32 1 /cre /ext
rem The following For loop is to divide logical partitions. Up to eight
for %%i in (%%d,%%e,%%f,%%g,%%h,%%i,%%j,%%k) do (
set /A op=%%i*%ss%
GDISK32 1 /cre /log /sz:!op! %frmty%
))
::Divide the remaining space into a logical partition
GDISK32 1 /cre /log /end %frmty%
echo.
echo Partition completed!
Last edited by wewebb on 2010-11-20 at 14:28 ]
|