如果存在特定大小的特定类型的文件,但是对于相同类型的文件执行另一个命令,则需要批处理脚本来执行命令。 然后我需要脚本运行另一个命令,如果第一个实例为true但文件包含标题中的内容。 下面是当前的脚本,但是当我只需要1或2时,我不希望底部的3行运行:
TASKKILL /IM "Plex Media Server.exe" /F
cd "C:\folder\Desktop"
robocopy "L:\folder1" *.mkv /mov /MAX:3200000000 /XF *keep*
robocopy "L:\folder2" *.mkv /mov /MIN:3200000000 /XF *.h-sbs.mkv *.h-ou.mkv *keep*
robocopy "L:\folder3" *.h-sbs.mkv *.h-ou.mkv /mov /MIN:3000000000
del *.sub *.idx *.html *.nfo *.sup *.txt *.htm
START "" "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe"
cd "C:\Program Files (x86)\Plex\Plex Media Server"
"Plex Media Scanner.exe" --scan --refresh --section 1
"Plex Media Scanner.exe" --scan --refresh --section 2
"Plex Media Scanner.exe" --scan --refresh --section 3
netsh interface set interface name="LAN 2" admin=enabled
exit
答案 0 :(得分:1)
这可能会让你开始。
@echo off
for %%I in (*.txt) do (
@echo File "%%~nI" is %%~zI bytes
if %%~zI GTR 1000 echo This is larger than 1kb!
if %%~zI LSS 1000 echo This is not 1kb :(
)
答案 1 :(得分:1)
cd "C:\Users\Admin\Desktop"
:START
for %%I in (*.mkv) do (
@echo File "%%~nI" is %%~zI bytes
if %%~zI LSS 3200000000 GOTO TV
if %%~zI GTR 3200000000 GOTO FILM
)
GOTO END
:TV
robocopy ".\" "L:\TV Shows 10" *.mkv /mov /MAX:3200000000 /XF *keep*
GOTO SCANTV
:FILM
robocopy ".\" "L:\HD Films 10" *.mkv /mov /MIN:3200000000 /XF *.h-sbs.mkv *.h-ou.mkv *keep*
robocopy ".\" "L:\3D HD Films 2" *.h-sbs.mkv *.h-ou.mkv /mov /MIN:3000000000
GOTO SCANFILM
:SCANTV
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 1
GOTO START
:SCANFILM
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 2
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3
:END
del *.sub *.idx *.html *.nfo *.sup *.txt *.htm
exit
谢谢D.A.这有助于最终达到这个目标,但这仍然是我能用它做的最好的事情:-s