本帖最后由 flashercs 于 2019-3-26 15:13 编辑
空白字符是Unicode的private use,是自定义字体库,字体中没有该字符就显示为空白或方框,只能提取出来.要想显示字体,用eudcedit.exe自己编辑字体库.
请将以下代码保存为 "提取.bat"- @echo off
- for /f "tokens=1 delims=:" %%A in ('findstr /n "#######*" %0') do more +%%A %0 >"%~dpn0.ps1"
- powershell.exe -ExecutionPolicy Bypass -File "%~dpn0.ps1"
- pause
- exit /b
- ################################################################
- # 要处理的txt文件路径或所在目录路径
- $filesystemobjectpath = 'E:\unzip\weibo_wordfreq.release.txt'
- # 是否处理子目录
- $isRecursive = $false
- function genFile {
- param (
- [string]$filepath
- )
- Write-Host $filepath -ForegroundColor Green
- $sr = [System.IO.StreamReader]::new($filepath, [System.Text.Encoding]::Default, $false)
- $sw = [System.IO.StreamWriter]::new($filepath + '_private.log', $false, [System.Text.Encoding]::Default)
- while (!$sr.EndOfStream) {
- $str = $sr.ReadLine()
- if ($str -match '[\uE000-\uF8FF]') {
- $sw.WriteLine($str)
- }
- }
- $sr.Close()
- $sw.Close()
- }
- function genFolder {
- param (
- [string]$folderPath,
- [switch]$recurse
- )
- if ($recurse) {
- Get-ChildItem -LiteralPath $folderPath -Filter '*.txt' -File -Include '*.txt' -Recurse|ForEach-Object {genFile $_.FullName}
- }
- else {
- Get-ChildItem -LiteralPath $folderPath -Filter '*.txt' -File -Include '*.txt'|ForEach-Object {genFile $_.FullName}
- }
- }
- if ((Get-Item -LiteralPath $filesystemobjectpath).Attributes -band [System.IO.FileAttributes]::Directory) {
- genFolder $filesystemobjectpath $isRecursive
- }
- else {
- genFile $filesystemobjectpath
- }
复制代码
|