本帖最后由 ygqiang 于 2016-8-17 15:54 编辑
[已解决]批处理,搜索特定目录下的rar压缩文件,解压缩。如果修改为:搜索所有盘符?- @echo off
- if "%1" == "h" goto begin
- mshta vbscript:createobject("wscript.shell").run("%~fs0 h",0)(window.close)&&exit
- :begin
- rem 下边开始写批处代码了
-
-
-
- echo 保存文件执行路径
- pushd "%~dp0"
-
-
- set "fdir=0-0朗科06"
- set files=00-00robocopy.rar 备份exe.rar 显示桌面.rar curl.rar devcon.rar dowld.rar grep.rar robocopy.rar sed.rar SETRES.rar VBScript.rar
-
- if exist "C:\Program Files\WinRAR\WinRAR.exe" set "rar=C:\Program Files\WinRAR\WinRAR.exe"
- if exist "C:\Program Files (x86)\WinRAR\WinRAR.exe" set "rar=C:\Program Files (x86)\WinRAR\WinRAR.exe"
- echo %rar%
-
-
-
- for %%a in (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 volumeinfo %%a:\ | findstr "错误" >nul && echo %%a不可读取 || echo %%a可读取 && (
-
-
- for /f "delims=" %%b in ('dir /ad/b/s %%a:\^|findstr "\\%fdir%$"') do (
- cd /d "%%b"
- for /f "delims=" %%c in ('dir /a-d/b/s %files%') do (
- echo;%%c
- "%rar%" x -y -ibck "%%c" "%%~dpc"
- )
- )
-
-
- )
- )
-
- cls
-
- echo 恢复文件执行路径
- popd
-
- cls
- ping 127.0.0.1 -n 5 >nul 2>nul
- exit
复制代码
|