问题
I have a folder with more files .ovpn contain text
Path: D:\Program files\config
Extension files: *.ovpn
I need to add in every files a new line contains mssfix 0 in a certain position in the file
mssfix 0 will be added at line 96
or creating a new line at line before resolv-retry infinite
Result before adding:
OTHER TEXT LINES
OTHER TEXT LINES
OTHER TEXT LINES
resolv-retry infinite
nobind
persist-key
persist-tun
client
verb 3
#auth-user-pass
OTHER TEXT LINES
OTHER TEXT LINES
OTHER TEXT LINES
Result after adding:
OTHER TEXT LINES
OTHER TEXT LINES
OTHER TEXT LINES
mssfix 0
resolv-retry infinite
nobind
persist-key
persist-tun
client
verb 3
#auth-user-pass
OTHER TEXT LINES
OTHER TEXT LINES
OTHER TEXT LINES
The files contain other text but other must not be edited.
I prefer a simple batch solution to avoid external software
WARNING: this is a part of text, before and after this part of file there is other lines of text to not to be changed.
来源:https://stackoverflow.com/questions/59801460/bat-file-to-add-new-line-in-a-certain-position-in-all-files-inside-a-folder