英文:
Detecting whether the terminal is the modern 'Terminal' app, or the regular 'Command Prompt' in csharp
问题
The modern 'Terminal' app from the Windows Store supports features that the classic 'Command Prompt' application does not. I'm looking for a way to detect which my application is running in so that I can drop down the features used within the console as appropriate.
英文:
The modern 'Terminal' app from the Windows Store supports features that the classic 'Command Prompt' application does not. I'm looking for a way to detect which my application is running in so that I can drop down the features used within the console as appropriate.
答案1
得分: 1
你可以查找"WT_SESSION"环境变量,参见此功能请求。
if (Environment.GetEnvironmentVariable("WT_SESSION") != null)
{
// 在Windows终端中运行
}
英文:
You can look for the "WT_SESSION" environment variable, see this Feature Request.
if (Environment.GetEnvironmentVariable("WT_SESSION") != null)
{
// running in Windows Terminal
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论