|
|
本帖最后由 sumirecccp 于 2016-8-26 04:07 编辑
实现输出指定命令的批处理求修改
主要诉求如下:
某个文件夹里有如下几个文件
VTS_01_PGC_02_CHAPTER_01_1.mp4
VTS_01_PGC_02_CHAPTER_02_1.mp4
……
VTS_01_PGC_03_CHAPTER_01_1.mp4
VTS_01_PGC_03_CHAPTER_02_1.mp4
……
VTS_01_PGC_02 - Chapter Information - OGG.txt
VTS_01_PGC_03 - Chapter Information - OGG.txt
……
想实现用批处理输出类似如下命令并执行:
"E:\D\software\megui\tools\mp4box\mp4box.exe" -add "VTS_01_PGC_02_CHAPTER_01_1.mp4" -cat "VTS_01_PGC_02_CHAPTER_02_1.mp4" -cat "VTS_01_PGC_02_CHAPTER_03_1.mp4" -cat "VTS_01_PGC_02_CHAPTER_04_1.mp4" -add "chapter\VTS_01_PGC_02 - Chapter Information - OGG.txt" -new 02.mp4
"E:\D\software\megui\tools\mp4box\mp4box.exe" -add "VTS_01_PGC_03_CHAPTER_01_1.mp4" -cat "VTS_01_PGC_03_CHAPTER_02_1.mp4" -cat "VTS_01_PGC_03_CHAPTER_03_1.mp4" -cat "VTS_01_PGC_03_CHAPTER_04_1.mp4" "VTS_01_PGC_03_CHAPTER_05_1.mp4" -add "chapter\VTS_01_PGC_03 - Chapter Information - OGG.txt" -new 03.mp4
难点在于:
PGC和CHAPTER后面的数字未必是从1开始,且中间可能有中断,也不知道具体结束的数字是多少(例:可能是2,3,5,7之类的,想要让电脑自动判断)
感谢xxpinqz的帮助,已解决,我修改了一下代码如下:- @echo off
- setlocal enabledelayedexpansion
- set com="E:\D\software\megui\tools\mp4box\mp4box.exe"
- for /f "delims=" %%a in ('dir /b VTS_01_PGC*.MP4') do (
- set "var=%%a"
- for %%b in ("@!var:~,13!@!var:~11,2!")do if not defined %%~b (set "%%~b=-add "%%a"") else set "%%~b=!%%~b! -cat "%%a""
- )
- for /f "tokens=1,2* delims=@=" %%a in ('set @') do (
- %com% %%c -add "%%a - Chapter Information - OGG.txt" -new %%b.mp4
- )
- pause
复制代码 |
评分
-
查看全部评分
|