本帖最后由 ygqiang 于 2016-4-29 13:37 编辑
已经解决- @echo off
- if exist c:\test.txt del /q c:\test.txt
- mountvol /L>>c:\test.txt
-
- mountvol /L>c:\test.txt
-
- ping 127.0.0.1 -n 3 >nul 2>nul
-
- @echo off
-
- echo 获取未分配的盘符
- if exist c:\test1.txt del /q c:\test1.txt
- for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
- rem if not defined pan (
- subst "%%i:" "%temp%" >nul 2>nul && (
- subst "%%i:" /d >nul 2>nul && set last_lab=%%i:
- echo %%i:>>c:\test1.txt
- ))
- )
-
-
- ping 127.0.0.1 -n 2 >nul 2>nul
-
- @echo off&setlocal enabledelayedexpansion
-
- echo 搜索txt文件关键字
- for /f "tokens=1 delims=:" %%a in ('type c:\test.txt^|findstr /n "\*\*\* *无装入点 *\*\*\*"') do (
- set/a i=%%a-1
- set #!i!=1
- )
- (for /f "tokens=1* delims=:" %%a in ('type c:\test.txt^|findstr /n .*') do (
- if defined #%%a (echo %%b)
- ))>c:\test2.txt
-
-
- ping 127.0.0.1 -n 2 >nul 2>nul
-
-
-
-
- @echo off&setlocal enabledelayedexpansion
-
- echo 提取txt文件,按行对应提取
- for /f "delims=" %%b in (c:\test2.txt) do (
- set /a n+=1
- call :p2 !n!
- echo !p! %%b && mountvol !p! %%b
- )
-
- goto :yctypf
-
-
-
-
- :p2
- set m=0
- for /f "delims=" %%c in (c:\test1.txt) do (
- set /a m+=1
- if !m! == %1 set p=%%c
- )
- goto :eof
-
-
-
- :yctypf
-
- ping 127.0.0.1 -n 20 >nul 2>nul
-
- @echo off
- echo 移动磁盘:
-
- echo 隐藏停用不可访问的盘符
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- fsutil fsinfo drivetype %%a: | find "移动">nul && (
-
- fsutil fsinfo volumeinfo %%a:\ | findstr "错误" >nul && echo %%a不可读取 && mountvol %%a: /d
-
- )
- )
-
- 1pause
- cls
-
- if exist c:\test.txt del /q c:\test.txt
- if exist c:\test1.txt del /q c:\test1.txt
- if exist c:\test2.txt del /q c:\test2.txt
-
- 1pause
- exit
-
-
-
-
-
-
- xp下也有mountvol这个命令,不过只有/D 和/L 二种参数。
-
- copy /y devcon.* C:\WINDOWS
- copy /y devcon.* C:\WINDOWS\system32
复制代码
|