我要替换一个文本文件,该文本文件在同一文本文件的一行中包含一个密码,但随机密码
示例:
<div class="flex-container">
<div style="order: 1; flex-basis: content; align-items:center; justify-content:flex-start; display: flex;">
<img src="http://kb4images.com/images/usa-wallpaper/36955559-usa-wallpaper.jpg"></img>
</div>
<div style="order: 2; flex-grow: 1; flex-basis: 28rem; max-height:500px; justify-content:flex-start; flex-shrink: 0;">
<div class="caja-scroll">
<div class="col-md-12 bordes_gallery">
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
<div class="gallery_item ">
<div id="imagen">
<img style="max-width:100px;" src="http://www.catolica.edu.sv/wp-content/uploads/2016/01/moodle-200x200.jpg">
</div>
<div id="texto">asdfadfs</div>
</div>
</div>
</div>
</div>
我想让批处理文件找到“ 12345678”并随机编辑 像这样的8位数字:
01 username:admin
02 password:12345678
03 login
答案 0 :(得分:0)
假设原始文件名为 pass.txt ,则此显示更改后的文件的外观。
@echo off& setlocal enabledelayedexpansion
for /f "delims=" %%l in (pass.txt) do (
set "l=%%l#$#"
for /f "delims=" %%p in ("!l:*password:=!") do if not "!l!"=="%%p" (
set /a "r=(!random!<<15|!random!)%%100000000+100000000"
set "l=!l:%%p=!!r:~1!#$#"
)
echo !l:~,-3!
)
没有评论新的“随机”密码的强度……这是另一个问题。