如何取得 unicode 档案名
时间:2014-06-19
来源:互联网
求教, 如何取得此名称?

I mean:
在folder见、用 dir, 知道有档案"逆转未来.pdf"
但想用batch取得档案名称, e.g. dir > list.txt
list.txt 中却见 : 逆?未?.pdf
E.g. Try...
1. dir *.pdf
2. dir *.pdf | more
不同, 只有1.是unicode.
作者: 111x111=12321 发布时间: 2014-06-19

作者: 111x111=12321 发布时间: 2014-06-19
chcp 65001
作者: tedbef 发布时间: 2014-06-19
before dir > list.txt, type:
chcp 65001

之前不断试 cmd /u 唔得.

C:\>cmd /?
Starts a new instance of the Windows XP command interpreter
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be Unicode
作者: 111x111=12321 发布时间: 2014-06-19
unicall.bat
cmd /u /c call dirlist.bat
exit
dirlist.bat
dir > filenames.txt
exit
作者: 斋煎 发布时间: 2014-06-19
cmd /u 得格。出黎个档案系 unicode LE 码。用适当的 txt editor,正确的 code page 咪开到囉。
unicall.bat
cmd /u /c call dirlist.bat
exit
dirlist.bat
dir > filenames.txt
exit
I tried Notepad.exe & I.E., native windows component, 是适当吧.
后者可选编码, ANYWAY, BOTH FAILED.
E.g. I.E. 编码 unicode
胆馪@S E -N茎胆馪/f E 胆馪@S耧_�: B845-A14B E:\ 茎襒�2014.06.10 12:47 11,762 蓠�*geg.pdf 2 P垪Hh 93,134 MOCQD} 0 P襒� 496,947,200 MOCQD}糇(u
作者: 111x111=12321 发布时间: 2014-06-19
作者: 斋煎 发布时间: 2014-06-19
作者: 斋煎 发布时间: 2014-06-19
用 ms word 试下吧。
太辛苦啦.

入左 WORD 佢知道系乱码, 叫拣, 拣拣拣 unicode 卒之得.
不过唔save 得, 要变做 .DOC, 即系 for your eyes only.
我想拿来用.
E.g. my.bat
copy 逆转未来.pdf D:

作者: 111x111=12321 发布时间: 2014-06-19
其实有很多方法。不同需要用不同的途径。如果一次性的,最简单是用 explorer,cntl A,shift right click,copy as path,入 acrobat,paste,save,就系咁简单。
用 script 做其实仲可以 pipe to clip.exe,然后在 pdf editor paste 返 clipboard。
各种方法各有各好。
作者: 斋煎 发布时间: 2014-06-19
将个 doc 用 acrobat 开然后 save as pdf 咪掂囉。
其实有很多方法。不同需要用不同的途径。如果一次性的,最简单是用 explorer,cntl A,shift right click,copy as path,入 acrobat,paste,save,就系咁简单。 ...
你误会左.
我唔系依家有个file要搞, 如果系, 我用gui, mouse drag啦.

我想知道依次序系concept(明明地就够), 重要系automate (*.bat, script, any language (treat as data no presentation, so codepage is not a problem)), 最后先系"呢个file去D:" ("将个 doc 用 acrobat 开然后 save as pdf 咪掂囉"@@)
copy 逆转未来.pdf D: 只是劳作习作, see the word "e.g."?
作者: 111x111=12321 发布时间: 2014-06-19
chcp 的方法是先更改 console codepage to xxxxx (default 是 950 中文繁体),然后 dir/tree pipe to 一个 txt file。
cmd /u 的方法是另开一个 unicode LE console,在这 console 里完成工作,然后跳回原来的 console。
output 既 txt file 的 codepage,第一个方法黎讲便是你指定的 xxxxx,第二个方法是固定了为 unicode LE。
之后将这个 txt file 点搅是后面的事。
要转 codepage 的话可用第三方软件,例如 iconv,windows 没有原生指令做这。
转 format 成 pdf 也是用第三方软件。
作者: 斋煎 发布时间: 2014-06-19
Ok, e.g. 我想完成呢个习作....
用方法一, 经notepad整理, 可得 1.bat, 内容为
dir 逆转未来.pdf
Run 个 1.bat 会 fail. 原因我知唔使讨论, 但点解决?

FYI:
其实1.bat 经另一种方法fail (原本都会fail, 因为个 1.bat text file有unicode prefix),
当 chcp 65001, 所以 .bat都唔行.

E.g. 2.bat 只得一句, echo Hello (OR pause, WHATEVER), 即return冇output
作者: 111x111=12321 发布时间: 2014-06-19
用 windows api FindFirstFile, 点先work?
个string系咩编码?
作者: 111x111=12321 发布时间: 2014-06-19
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28