@echo off
set get=
tw /np > nul
echo.
get s "请输入你想格式化的盘符( 如 C ) : "
if "%get%#"=="#" goto nodrvnum
set drive=%get%
set get=
:promp
echo.
echo.
get n "如果格式化该盘所有的数据将丢失,您真的想继续吗?[Y,N]"
if "%get%"=="Y" goto format
if "%get%"=="N" goto end
cls
echo.
echo 请输入你想格式化的盘符( 如 C ) : %drive%
goto promp
:format
echo.
echo 正在格式化,请稍候...
format %drive%: /q /u /autotest > nul
set get=
echo.
echo.
get s "请为%drive%盘输入卷标(最大为11个字符,如果不要卷标,请直接按回车): "
if "%get%#"=="#" goto nolabel
label %drive%:%get% > nul
echo.
echo %drive%盘卷标是%get%,格式化已经完成,请按任意键退出。
pause > nul
goto end
:nolabel
echo.
echo %drive%盘没有卷标,格式化已经完成,请按任意键退出。
pause > nul
goto end