[英]Insert a command into a specific line from batch file to another batch file
我想將以下命令插入第一行,並將自毀命令插入另一批的最后一行
if not "%1" == "max" start /MAX cmd /c %0 max & exit/b
我的批次:
@echo off
if not "%1" == "max" start /MAX cmd /c %0 max & exit/b
CD %~dp0mkvtoolnix
pause. >nul | echo. Press Enter To Analyze MKV Files
echo. Analyzing MKV Files
@echo on
%~dp0ChapterUnorderer.exe %~dp0 [-o] [-f]
<New command that I require>
@echo off
pause. >nul | echo. Press Enter To Remux
START %~dp0ChapterUnorderer.bat
pause
del "%~dp0ChapterUnorderer.bat"
編輯此批處理不能具有絕對路徑,並且我的批處理名稱中有空格(如果有幫助)
為了您的方便:
Echo New first line>Newfile
more oldfile>>newfile
ren oldfile oldfile.bak
ren newfile oldfile
如果要替換oldfile中的第一行,請在其后插入+1
。
對於自我毀滅,請參閱@dbenham的答案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.