|
|
发表于 2019-6-26 12:20:57
|
显示全部楼层
- @echo off
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- set n=5
- powershell -NoProfile -ExecutionPolicy bypass ^
- $files=@(dir^|?{('.txt' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])});^
- for($i=0;$i -lt $files.length;$i++){^
- write-host $files[$i].Name;^
- $text=[IO.File]::ReadAllLines($files[$i].FullName,[Text.Encoding]::Default);^
- if($text.length -ge %n%){^
- $text[%n%-1]=((' '*2)+$files[$i].BaseName);^
- [IO.File]::WriteAllLines($files[$i].FullName, $text, [Text.Encoding]::Default);^
- };^
- };^
- write-host '%info%' -ForegroundColor green;
- pause
复制代码 |
|