|
|
发表于 2022-5-30 13:28:46
|
显示全部楼层
本帖最后由 flashercs 于 2022-5-30 14:10 编辑
- <#*,:&cls
- @echo off
- cd /d "%~dp0"
- powershell -C "Set-Location -LiteralPath ([Environment]::CurrentDirectory);. ([ScriptBlock]::Create((Get-Content -LiteralPath "%~f0" -ReadCount 0 | Out-String)))"
- pause
- exit /b
- #>
- $file1 = "123.txt"
- $file2 = "abc.txt"
- # 格式化字符串
- $format = '{0}+ABC.{1}'
- $ht = @{}
- foreach ($line in (Get-Content -ReadCount 0 -LiteralPath $file1)) {
- $k, $v = $line -split ',', 2
- $ht[$k] = $v
- }
- $(foreach ($line in (Get-Content -ReadCount 0 -LiteralPath $file2)) {
- $k, $v = $line -split '_', 2
- if ($ht.ContainsKey($k)) {
- $format -f ($ht[$k]), $v
- }
- }) | Set-Content -LiteralPath .\a.txt
复制代码 |
评分
-
查看全部评分
|