本帖最后由 newswan 于 2023-5-3 14:05 编辑
假设 content.opf 编码是 UTF8
如果显示正确,去掉第十行的 # | $root = "." | | $insert = ' <item id="Cbeta.ttf" href="Fonts/Cbeta.ttf" media-type="application/x-font-ttf"/>' | | | | $fld = Get-ChildItem -Directory -Path $root | | $fld | ForEach-Object { | | if ( Test-Path (Join-Path $_.FullName "\Fonts\Cbeta.ttf") ) { | | $file = Get-Content -Encoding UTF8 (Join-Path $_.FullName "content.opf") | | $file = $file -replace '(?=</manifest>)',($insert + "`r`n") | | $file | | | | } | | }COPY |
如果想要用批处理,把这行添加到上面第一行@cd /d %~dp0 & powershell -command "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause & exit/bCOPY
|