本帖最后由 newswan 于 2021-9-5 08:21 编辑
直接修改文件- @cd /d %~dp0 & powershell -command "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause & exit/b
-
- set $sour= "."
-
- Get-ChildItem -Path $sour -Filter "*.txt" -Recurse | foreach-object {
- write-host ("`n" + $_.fullname)
- get-content $_ | foreach-object {
- if ($_ -match "(.*:)(\d+(?:.\d)?) cm")
- {
- $inch = [Math]::Round(([double]$matches[2]) * 0.3937007874 , 1)
- ($matches[1] + $inch + " inch")
- }
- else
- {
- $_
- }
- } | out-file ($_.fullname)
- }
复制代码
|