本帖最后由 newswan 于 2021-8-3 01:04 编辑
- $sour = "aaa"
- $ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) }
- Get-ChildItem -path $sour -Filter "*.txt" |
- Sort-Object $ToNatural |
- ForEach-Object {
- get-content -Encoding utf8 $_.fullname |
- Out-File -Append (( $_.basename -replace "\d+$","" ) + ".txt")
- }
复制代码
|