本帖最后由 娜美 于 2024-5-15 23:32 编辑
回复 36# aloha20200628
大哥哥32楼那个可以了
大哥哥请看看 套进这个里面 似乎返回一些错误- @echo off &setlocal &del /q "allinOne.txt" "bug.txt" 2>nul
- for /f "delims=" %%F in (b.txt) do if not exist "%%~F" (echo,"badFile -- %%F"&echo,%%F>>"bug.txt") else (
- for /f "tokens=1-2 delims=-" %%a in (' uchardet.exe "%%~F" ') do (
- if /i "%%a" neq "unknown" (echo, /// %%~F ///>>"allinOne.txt")
- if /i "%%a"=="utf" if "%%b"=="8" (
- powershell " gc '%%~F' -readcount 1000 -enc 'utf8'|ac 'allinOne.txt' "
- ) else if /i "%%a"=="utf" if "%%b"=="16" (
- powershell " gc '%%~F' -readcount 1000 -enc 'utf16'|ac 'allinOne.txt' "
- )
- if /i "%%a"=="ascii" (
- powershell " gc '%%~F' -readcount 1000 -enc 'ascii'|ac 'allinOne.txt' "
- ) else if /i "%%a"=="gb18030" (
- powershell " gc '%%~F' -readcount 1000 -enc 'default'|ac 'allinOne.txt' "
- ) else if /i "%%a"=="unknown" (
- echo,"unknown -- %%F"&echo,%%F>>"bug.txt"
- )
- )
- echo,>>"allinOne.txt"
- )
- endlocal&pause&exit/b
复制代码
- Get-Content : 无法绑定参数“Encoding”。无法将值“utf16”转换为类型“Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding”。错误:“无法将标识符名称 utf16 与有效的枚举器名称相匹配。请指定以下枚举器名称之一,然后重试:
- Unknown, String, Unicode, Byte, BigEndianUnicode, UTF8, UTF7, UTF32, Ascii, Default, Oem, BigEndianUTF32”
- 所在位置 行:1 字符: 47
- + gc 'UTF16BE-UNIX编码.txt' -readcount 1000 -enc 'utf16'|ac 'allinOne.tx ...
- + ~~~~~~~
- + CategoryInfo : InvalidArgument: (:) [Get-Content],ParameterBindingException
- + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetContentCommand
复制代码
|