|
本帖最后由 dos时代菜鸟 于 2018-3-12 23:10 编辑
auto_drv.zip
(708 Bytes, 下载次数: 45)
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- color 0a
- mode con: lines=40 cols=120
- echo 正在探测未挂载的卷......
- >%temp%\lp.txt echo list vol
- diskpart /s %temp%\lp.txt >%temp%\dl.txt
- type %temp%\dl.txt
- set t0=
- set n=0
- >%temp%\lp.txt echo.
- for /f "tokens=1,*" %%c in (%temp%\dl.txt) do (
- set l0=%%c
- set l1=%%d
- if "!l0:~0,1!"=="-" set "t0=ok"
- if "!t0!"=="ok" (if not "!l0:~0,1!"=="-" ( rem 确认当前行为数据行
- if "!l1:~6,1!"==" " ( rem 判断当前卷没有被挂载盘符
- set /a n=!n!+1
- for /f "tokens=1" %%e in ("%%~d") do ( rem 获取卷号并将挂载指令传递给脚本
- >>%temp%\lp.txt echo select vol %%e
- >>%temp%\lp.txt echo assign
- )
- )
- ))
- )
-
- if !n! GTR 0 (
- >>%temp%\lp.txt echo list vol
- echo 发现 !n! 个未挂载卷,挂载脚本已生成:
- echo -------------------------
- type %temp%\lp.txt
- echo -------------------------
- echo 按任意键开始挂载...
- pause>nul
- diskpart /s %temp%\lp.txt
- ) else (echo 未发现没有被挂载的卷)
-
- pause
-
复制代码 |
评分
-
查看全部评分
|