유용한 배치파일

현재 디스크 확인

집앞의 큰나무 2022. 11. 30. 08:34

@echo off

for /f "tokens=4,5 skip=1 delims=\" %%a in ('wmic os get Name') do set dis=%%a& set par=%%b

)
echo select volume C > bpt.scr
echo list part >> bpt.scr
diskpart /s bpt.scr > bp1.txt
find "MB " bp1.txt > bp2.txt
set BOOTPART=
for /f "tokens=1-4 usebackq" %%a in ("bp2.txt") do (

set BOOTPART=%%b


)
)

if exist bpt.scr del bpt.scr
if exist bp1.txt del bp1.txt
if exist bp2.txt del bp2.txt

echo.&echo.&echo.
echo        %dis:Harddisk=% 번 디스크
echo.
set par=%par:Partition=%
echo           %par: =% 번 파티션-윈도우
echo.
echo.          %BOOTPART% 번 파티션-부팅 파티션
pause >nul
exit

 

현재의 디스크 번호2.cmd
0.00MB