[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 批处理如何在固定的语句后面添加

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每次都要手动搜索添加  实在太难受  有没有 批处理的方式呢?

  1. Dim strFile: strFile = "uup_download_windows.cmd"
  2. Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
  3. Dim objFile: Set objFile = FSO.OpenTextFile(strFile)
  4. Dim strContent: strContent = objFile.Readall
  5. objFile.Close
  6. Dim objRegEx: Set objRegEx = CreateObject("VBScript.RegExp")
  7. objRegEx.Global = True
  8. objRegEx.IgnoreCase = True
  9. objRegEx.Pattern = "--no-conf --log-level=info"
  10. Dim objNewText: objNewText = objRegEx.Replace(strContent,"--no-conf --check-certificate=false --log-level=info")
  11. Dim objTextFile: Set objTextFile = FSO.CreateTextFile("aria2_download_windows_new.cmd")
  12. objTextFile.Write objNewText
  13. objTextFile.Close
  14. Set FSO = Nothing
  15. Set ws = CreateObject("WScript.Shell")
  16. ws.Run "cmd.exe /c aria2_download_windows_new.cmd"
复制代码
这是一个  大神发的  可是 出现

TOP

......
大神   帮忙啊@@

TOP

  1. Dim strFile: strFile = "uup_download_windows.cmd"
  2. Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
  3. Dim objFile: Set objFile = FSO.OpenTextFile(strFile)
  4. Dim strContent: strContent = objFile.Readall
  5. objFile.Close
  6. Dim objRegEx: Set objRegEx = CreateObject("VBScript.RegExp")
  7. objRegEx.Global = True
  8. objRegEx.IgnoreCase = True
  9. objRegEx.Pattern = "--no-conf --log-level=info"
  10. Dim objNewText: objNewText = objRegEx.Replace(strContent,"--no-conf --check-certificate=false --log-level=info")
  11. Dim objTextFile: Set objTextFile = FSO.CreateTextFile("uup_download_windows_new.cmd")
  12. objTextFile.Write objNewText
  13. objTextFile.Close
  14. Set FSO = Nothing
  15. Set ws = CreateObject("WScript.Shell")
  16. ws.Run "cmd.exe /c uup_download_windows_new.cmd"
复制代码

TOP

返回列表