本帖最后由 qixiaobin0715 于 2023-6-28 14:01 编辑
如果文本中user和password都是有4个 “-” 隔开:- @echo off
- setlocal enabledelayedexpansion
- (for /f "delims=" %%i in ('findstr "\----" 1.txt') do (
- set "str=%%i"
- set "str=!str:----=`!"
- for /f "tokens=1* delims=`" %%j in ("!str!") do (
- echo, - user: "%%j"
- echo, password: "%%k"
- echo, secret: ""
- echo,
- )
- ))>2.txt
复制代码
|