我有 CMD 输出文本文件的问题。 文本文件里面是中文符号,而不是简单的短信。
命令:
::this will check if is PC online.
set LOCALV_WORKSTATIONUP=0
( wmic /FAILFAST:ON /user: "admin" /password:"123456" /node:"Workstation1.subdomain.domain" computersystem get "Name" >>Check.txt ) && set LOCALV_WORKSTATIONUP=1
::this will execute something while PC is online. And this is also problematic part.
IF "!LOCALV_WORKSTATIONUP!" == "1" (echo "It's working." >> Check.txt) ELSE (echo "It's NOT working." >> Check.txt)
输出文本文件 Check.txt 包含:
Workstation1
䤢❴低⁔潷歲湩•
代替:
Workstation1
It's working.
Screenshot of CMD + output text file
chcp
更改为 850
、852
、437
、65001
、1250
,但没有更改。符号没有改变。|more>> Check.txt
一切都没有成功。
如何以请求的格式获取输出文本文件?
答案 0 :(得分:0)
尝试使用
Console.OutputEncoding = Encoding.GetEncoding(936);
在从源到目的地的旅程的某个时刻,您的 unicode 字符串已经通过一些不理解 unicode 的东西。