304230411 当前离线
列兵
评分人数
TOP
flashercs 当前在线
少校
@echo off cd /d "%~dp0" powershell -c "gci .\*.txt|foreach-object{$lines=($_|gc -readcount 0);if($lines.count -ge 307){$lines[306]=($lines[306],'123456789','23457823') -join ([environment]::newline);sc -literalpath $_.fullname -value $lines;}}" pause exit /b复制代码
went 当前离线
#&cls&@cd /d "%~dp0"&powershell -c "Get-Content '%~0' | Out-String | Invoke-Expression" & pause&exit cls #文本编码 ascii utf8 $txt_enc = 'utf8' #插入行数,0开始 $line_num = 306 #插入内容 $insert_txt = @' 307::123456789 308:23457823 '@ Get-ChildItem '*.txt' | foreach { Write-Host $_.FullName $arr = Get-Content $_.FullName -Encoding $txt_enc if($arr.Count -ge $line_num){ &{ $arr[0..($line_num-1)] $insert_txt $arr[$line_num..($arr.Count-1)] } | Out-File $_.FullName -Encoding $txt_enc } }复制代码