以前写了一个批处理,基本上可以实现你要的功能,发出来给你参考。- @echo off && setlocal enabledelayedexpansion
- md %windir%\mountvol>nul 2>nul
- for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
- (set var=%%i) & (set drive1=!var:~-2!) & (set drive=!drive1:~0,1!)
- for /f "tokens=*" %%h in ('fsutil fsinfo drivetype !drive!:') do set drivetype=%%h
- echo !drivetype! | find "固定">nul
- if errorlevel 1 (set query=未知) & (set residualm=未知) & goto echo
- for /f "tokens=4" %%j in ('fsutil dirty query !drive!:') do set query=%%j
- for /f "tokens=3" %%k in ('dir /-c !drive!:\') do set residual=%%k
- set /a residualm=!residual:~0,-3!/1049
- :echo
- call echo !drivetype!,!query!,可用空间约 !residualm!M
- echo\
- mountvol !drive!: /l | findstr /v : >%windir%\mountvol\!drive!mountvol.inf
- )
- echo ---被隐藏的磁盘是不显示在上面的,可以选L加载磁盘&echo/
- echo. [D].隐藏磁盘 [L].加载磁盘
- echo/&set/p DORL=[D/L]:
- set/p disk=指定要操作的盘符(如 D ):
- if /i "%dorl%"=="d" (mountvol %disk%: /d)
- if /i "%dorl%"=="l" (
- for /f %%j in (%windir%\mountvol\%disk%mountvol.inf) do (
- mountvol %disk%: %%j
- goto ok
- )
- )
- :ok
- echo 操作成功,按任意键退出.
- pause>nul
复制代码
|