到目前为止,我已经创建了一个批处理文件,该文件为文件添加后缀'所选文件夹中的名称,类型为:
现在,我想添加选项以通过*.srt
/ *.ass
文件(字幕文件)搜索特定文本,并删除包含找到的文本的行(如果它存在的话)在文件中)。我还想选择用另一个替换找到的文本。
我希望我所要求的是可能的,并且非常感谢您提供的任何帮助。
到目前为止我的代码:
@if (@CodeSection == @Batch) @then
@echo off
setlocal EnableDelayedExpansion
rem Select the folder via WSH Shell.Application BrowseForFolder method
for /F "delims=" %%a in ('cscript //nologo //E:JScript "%~F0"') do set "folder=%%a"
if not defined folder goto :EOF
cd "%folder%"
for /F "delims=" %%a in ('dir /B /A-D *.avi *.mkv *.mp4 *.ass ^| findstr /I /V ".created_by_me"') do (
set "fileName=%%a"
rem Convert the file name to lowercase letters
for %%a in (a b 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 (
set "fileName=!fileName:%%a=%%a!"
)
if "!fileName!" equ "%%a" (
rem The original file name have all lowercase letters
ren "%%a" "%%~Na.created_by_me%%~Xa"
) else (
rem The original file name include at least one uppercase letter
ren "%%a" "%%~Na.Created_By_Me%%~Xa"
)
)
goto :EOF
@end
// JScript section
var shl = new ActiveXObject("Shell.Application");
var folder = shl.BrowseForFolder(0, "Please choose a folder.\nThis extension will add a \".HebSubs-Tvil.Me\" suffix to each file of the following types: *.ASS; *.AVI; *.MKV; *.MP4", 0, 0x00);
WSH.echo(folder ? folder.self.path : "");