[英]How to set C# Console Application to use default console settings (Windows Server 2012)?
Created a console application using C#/Visual Studio 2017. When I run the console application from VS or on a Windows 10 machine, it uses the default settings for my console application (Options/Font/Layout/Colors) which is perfect.使用 C#/Visual Studio 2017 创建了一个控制台应用程序。当我从 VS 或 Windows 10 机器上运行控制台应用程序时,它使用我的控制台应用程序的默认设置(选项/字体/布局/颜色),这是完美的。 However when I try to run it on a Test Server using Windows Server 2012 R2, it uses random settings (small buffer size/large font/odd shaped window).但是,当我尝试在使用 Windows Server 2012 R2 的测试服务器上运行它时,它使用随机设置(小缓冲区大小/大字体/奇形窗口)。 I've tried:我试过了:
When I run the application from command line(program.exe), it uses the default settings.当我从命令行(program.exe)运行应用程序时,它使用默认设置。 But when I click on the executable it does not.但是当我点击可执行文件时,它没有。 What am I missing here?我在这里缺少什么?
Apparently there's two different settings for the console.显然,控制台有两种不同的设置。 One for the User Account and another for initial console window title(in this case my application).一个用于用户帐户,另一个用于初始控制台窗口标题(在本例中为我的应用程序)。 I was able to look at the settings within Regedit.exe, HCKU/Console key and remove the settings for my initial console window title and then ran application (as admin) and changed the defaults there.我能够查看 Regedit.exe、HCKU/Console 键中的设置并删除初始控制台窗口标题的设置,然后运行应用程序(以管理员身份)并更改那里的默认设置。 Thank you for the comments!谢谢你的意见!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.