比如,如何得知G盘为第几硬盘第几分区?
补充:在CMD环境下……
[ Last edited by fatball on 2007-12-24 at 11:35 AM ]
补充:在CMD环境下……
[ Last edited by fatball on 2007-12-24 at 11:35 AM ]
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims= " %%a in ('echo list disk ^|diskpart ^|findstr /r /c:"磁盘 "') do (
@echo select disk=%%b>%%b.script
@echo list partition>>%%b.script
@echo exit>>%%b.script
for /f "tokens=1,2 delims= " %%m in ('diskpart /s %%b.script ^|findstr /r /c:"分区 "') do (
set /a num=%%n-1
)
del %%b.script
echo 磁盘 %%b 含有 !num! 个分区
)
for %%a in (C D E F G H I J K L M N O P Q R S T U V W) do (
vol %%a: >nul 2>nul
if not errorlevel 1 (
for /f "tokens=3" %%b in ('dir /-c %%a:\^|find "可用字节"') do set freesize=%%b
set /a freesize=!freesize:~0,-3!/1049>nul
echo %%a 盘剩余空间: !freesize! MB
) else (
goto end
)
)
:end
pause@echo off
setlocal enabledelayedexpansion
set count=0
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && set /a count=!count!+1
)
echo %count% 个固定磁盘
PAUSE@echo off
setlocal enabledelayedexpansion
set count=0
@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,Description /format:csv^|find /i "固定"') do echo %%i&set /a count=!count!+1
echo %count% 个固定磁盘
PAUSE@echo off
setlocal enabledelayedexpansion
set count=0
for /f "skip=1 tokens=1,3 delims== " %%i in ('MiniToW /p /ifs^|find ":"') do echo %%i %%j&set /a count=!count!+1
echo %count% 个磁盘 (包括U盘)
PAUSEOriginally posted by fastslz at 2007-12-24 02:11 PM:
@echo off
setlocal enabledelayedexpansion
set count=0
@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,Description /format:csv^|find /i & ...
1:1 C:
1:2 D:
1:3 E:
1:4 F:
1:5 G:
1:6 H:
2:1 I:
2:2 K:
2:3 L:
3:1 N:
4:1 O:
4:2 P:
12 个磁盘 (包括U盘)
请按任意键继续. . .