本帖最后由 lxzzr 于 2011-5-7 09:53 编辑
我给你个(单个盘符)- @echo off
- setlocal enabledelayedexpansion
- if exist h:\. (
- mountvol h: /d
- ) else (
- for /f "tokens=1,2 delims=: " %%a in (
- 'mountvol ^| findstr /n "\*" ^&
- mountvol ^| findstr /n "\\\\\?\\Volume \\"'
- ) do (
- if not defined index set /a index=%%a-1
- if !index! == %%a (
- mountvol h: %%b
- exit
- )
- )
- )
- exit
复制代码
|