
标题: [文件操作] 批处理如何在固定的语句后面添加 [打印本页]
作者: lovekix 时间: 2020-7-2 08:13 标题: 批处理如何在固定的语句后面添加
echo Attempting to download files...
"%aria2%" --no-conf --check-certificate=false --log-level=info --log="aria2_download.log" -x16 -s16 -j5 -c -R -d"%destDir%" -i"%aria2Script%"
if %ERRORLEVEL% GTR 0 call
OWNLOAD_ERROR & exit /b 1
这样的语句 想在 "%aria2%" --no-conf 后面添加 --check-certificate=false每次都要手动搜索添加 实在太难受 有没有 批处理的方式呢?
作者: lovekix 时间: 2020-7-2 09:47
- Dim strFile: strFile = "uup_download_windows.cmd"
- Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
- Dim objFile: Set objFile = FSO.OpenTextFile(strFile)
- Dim strContent: strContent = objFile.Readall
- objFile.Close
- Dim objRegEx: Set objRegEx = CreateObject("VBScript.RegExp")
- objRegEx.Global = True
- objRegEx.IgnoreCase = True
- objRegEx.Pattern = "--no-conf --log-level=info"
- Dim objNewText: objNewText = objRegEx.Replace(strContent,"--no-conf --check-certificate=false --log-level=info")
- Dim objTextFile: Set objTextFile = FSO.CreateTextFile("aria2_download_windows_new.cmd")
- objTextFile.Write objNewText
- objTextFile.Close
- Set FSO = Nothing
- Set ws = CreateObject("WScript.Shell")
- ws.Run "cmd.exe /c aria2_download_windows_new.cmd"
复制代码
这是一个 大神发的 可是 出现
作者: lovekix 时间: 2020-7-6 21:25
......
大神 帮忙啊@@
作者: lovekix 时间: 2020-7-6 21:29
- Dim strFile: strFile = "uup_download_windows.cmd"
- Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
- Dim objFile: Set objFile = FSO.OpenTextFile(strFile)
- Dim strContent: strContent = objFile.Readall
- objFile.Close
- Dim objRegEx: Set objRegEx = CreateObject("VBScript.RegExp")
- objRegEx.Global = True
- objRegEx.IgnoreCase = True
- objRegEx.Pattern = "--no-conf --log-level=info"
- Dim objNewText: objNewText = objRegEx.Replace(strContent,"--no-conf --check-certificate=false --log-level=info")
- Dim objTextFile: Set objTextFile = FSO.CreateTextFile("uup_download_windows_new.cmd")
- objTextFile.Write objNewText
- objTextFile.Close
- Set FSO = Nothing
- Set ws = CreateObject("WScript.Shell")
- ws.Run "cmd.exe /c uup_download_windows_new.cmd"
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |