我正在通过batch
脚本尝试Unrar 400文件。
在我的文件夹文件与视频混合
一些文件名是“love.blood.repack.mp4”
我在我的脚本中为find rar文件添加 .r
但脚本显示视频文件,如“love.blood .r
epack.mp4”
如何检查扩展名是否有.rar .r001 .r01 .r02等然后运行unrar? 仅检查扩展名不是完整文件名
c:\unrar.bat c:\mymixedfolder
我的Windows .bat批处理脚本
@echo off &setlocal
set /a nfile=0
echo Copying directory structure from %1 to %2 ...
xcopy /T "%~1" "%~2"
REM walk directory structure and convert each file in quiet mode
set "sourcefolder=%~1"
set "targetfolder=%~2"
for /R "%sourcefolder%" %%a in (*.r*) do (
echo converting "%%~nxa" ...
set "sourcefile=%%~fa"
set "sourcepath=%%~dpa"
set "targetfile=%%~na.flv"
setlocal enabledelayedexpansion
set "targetfolder=%targetfolder%!sourcepath:%sourcefolder%=!"
echo "%%~nxa"
endlocal
set /A nfile+=1
)
echo Done! Unrar %nfile% file(s)
答案 0 :(得分:0)
尝试:
@ECHO OFF &SETLOCAL disableDelayedExpansion
SET "sourcefolder=."
FOR /R "%sourcefolder%" %%a IN (*.r*) DO (
FOR /f "delims=" %%b IN ('echo %%~xa^|findstr /r "\.r.*"') DO ECHO %%~a
)
答案 1 :(得分:0)
这是另一种选择:
@ECHO OFF
SET "sourcefolder=."
FOR /R "%sourcefolder%" %%a IN (*.r??) DO (
if /i "%%~xa"==".rar" DO ECHO %%~a
)