cmd.exe 中的控制台输出,以及 C++ 中的 powershell.exe

And*_*man 5 c++ console powershell cmd

我知道一种在Cmd.exe. 但是我该怎么做Powershell.exe呢?

#include<iostream>
#include<windows.h>

using namespace std;
int main()
{
    SetConsoleCP(GetACP());
    SetConsoleOutputCP(GetACP());

    // valid output in cmd.exe, 
    // but invalid output in powershell.exe
    cout << "?????? ??? (1)!" << endl; 

    // invalid output in both variants: cmd.exe, 
    // and powershell.exe
    wcout << L"?????? ??? (2)!" << endl; 

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

rha*_*vin 0

输出是什么?您的字体支持这些字形吗?

也许以下链接可能有用(关于 cmd.exe):

http://www.watchingthenet.com/how-to-add-and-change-fonts-in-windows-command-prompt.html

您还可以尝试将 powershell 的输出重定向到文件并进行检查。如果文件正确,则您的控制台字体不支持您的字符。

还有ms的博客,展示了如何自定义字体(关于ps)

http://blogs.msdn.com/b/powershell/archive/2006/10/16/windows-powershell-font-customization.aspx