- What is Windows Terminal?
- Multiple profiles supporting a variety of command line applications
- Customized schemes and configurations
- Custom actions
- Unicode and UTF-8 character support
- GPU accelerated text rendering
- Background image support
- Command line arguments
- Что такое Терминал Windows? What is Windows Terminal?
- Несколько профилей, поддерживающих различные приложения командной строки Multiple profiles supporting a variety of command line applications
- Настраиваемые схемы и конфигурации Customized schemes and configurations
- Настраиваемые действия Custom actions
- Поддержка символов Юникода и UTF-8 Unicode and UTF-8 character support
- Отрисовка текста с ускоренным GPU GPU accelerated text rendering
- Поддержка фоновых изображений Background image support
- Аргументы командной строки Command line arguments
- How to open console windows
- Answered by:
- Question
- Answers
- All replies
What is Windows Terminal?
Windows Terminal is a modern terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and Windows Subsystem for Linux (WSL). Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts.
Multiple profiles supporting a variety of command line applications
Any application that has a command line interface can be run inside Windows Terminal. This includes everything from PowerShell and Command Prompt to Azure Cloud Shell and any WSL distribution such as Ubuntu or Oh-My-Zsh.
Customized schemes and configurations
You can configure your Windows Terminal to have a variety of color schemes and settings. To learn how to make your own color scheme, visit the Color schemes page. You can also find custom Terminal configurations in the Custom terminal gallery.
Custom actions
There are a variety of custom commands you can use in Windows Terminal to have it feel more natural to you. If you don’t like a particular keyboard shortcut, you can change it to whatever you prefer.
For example, the default shortcut to copy text from the command line is ctrl+shift+c . You can change this to ctrl+1 or whatever you prefer. To open a new tab, the default shortcut is ctrl+shift+t , but maybe you want to change this to ctrl+2 . The default shortcut to flip between the tabs you have open is ctrl+tab , this could be changed to ctrl+- and used to create a new tab instead.
You can learn about customizing shortcuts on the Actions page.
Unicode and UTF-8 character support
Windows Terminal can display Unicode and UTF-8 characters such as emoji and characters from a variety of languages.
GPU accelerated text rendering
Windows Terminal uses the GPU to render its text, thus providing improved performance over the default Windows command line experience.
Background image support
You can have background images and gifs inside your Windows Terminal window. Information on how to add background images to your profile can be found on the Profile — Appearance page.
Command line arguments
You can set Windows Terminal to launch in a specific configuration using command line arguments. You can specify which profile to open in a new tab, which folder directory should be selected, open the terminal with split window panes, and choose which tab should be in focus.
For example, to open Windows Terminal from PowerShell with three panes, with the left pane running a Command Prompt profile and the right pane split between your PowerShell and your default profile running WSL, enter:
Learn how to set up command-line arguments on the Command line arguments page.
Что такое Терминал Windows? What is Windows Terminal?
Терминал Windows — это современное приложение терминала для пользователей таких программ и оболочек командной строки, как «Командная строка», PowerShell и «Подсистема Windows для Linux» (WSL). Windows Terminal is a modern terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and Windows Subsystem for Linux (WSL). К его основным функциям относится поддержка нескольких вкладок, панелей, символов Юникода и UTF-8, а также модуль отрисовки текста с ускорением GPU, возможность создания собственных тем и настройки текста, цвета, фона и сочетаний клавиш. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts.
Несколько профилей, поддерживающих различные приложения командной строки Multiple profiles supporting a variety of command line applications
Любое приложение с интерфейсом командной строки можно выполнять в Терминале Windows. Any application that has a command line interface can be run inside Windows Terminal. Это касается всех приложений: от PowerShell и Командной строки до Azure Cloud Shell и любого дистрибутива WSL, например Ubuntu или Oh-My-Zsh. This includes everything from PowerShell and Command Prompt to Azure Cloud Shell and any WSL distribution such as Ubuntu or Oh-My-Zsh.
Настраиваемые схемы и конфигурации Customized schemes and configurations
В Терминале Windows можно настроить различные цветовые схемы и параметры. You can configure your Windows Terminal to have a variety of color schemes and settings. Сведения о создании собственной цветовой схемы см. на этой странице. To learn how to make your own color scheme, visit the Color schemes page. Пользовательские конфигурации Терминала также можно найти на странице о настраиваемой коллекции терминала. You can also find custom Terminal configurations in the Custom terminal gallery.
Настраиваемые действия Custom actions
Существует множество пользовательских команд, которые можно использовать в Терминале Windows для удобства работы. There are a variety of custom commands you can use in Windows Terminal to have it feel more natural to you. Если вам не нравится конкретное сочетание клавиш, вы можете изменить его на любое другое. If you don’t like a particular keyboard shortcut, you can change it to whatever you prefer.
Например, для копирования текста из командной строки по умолчанию используются клавиши CTRL+SHIFT+C . For example, the default shortcut to copy text from the command line is ctrl+shift+c . Вы можете изменить его на CTRL+1 или другое сочетание. You can change this to ctrl+1 or whatever you prefer. Для открытия новой вкладки по умолчанию используется сочетание клавиш CTRL+SHIFT+T , но его можно изменить на CTRL+2 . To open a new tab, the default shortcut is ctrl+shift+t , but maybe you want to change this to ctrl+2 . Для перехода на другие открытые вкладки по умолчанию используется сочетание клавиш CTRL+TAB . Его можно изменить на CTRL+- и использовать для создания новой вкладки. The default shortcut to flip between the tabs you have open is ctrl+tab , this could be changed to ctrl+- and used to create a new tab instead.
Дополнительные сведения о настройке сочетаний клавиш см. на странице «Действия». You can learn about customizing shortcuts on the Actions page.
Поддержка символов Юникода и UTF-8 Unicode and UTF-8 character support
В Терминале Windows могут отображаться символы Юникода и UTF-8, например эмодзи и символы из различных языков. Windows Terminal can display Unicode and UTF-8 characters such as emoji and characters from a variety of languages.
Отрисовка текста с ускоренным GPU GPU accelerated text rendering
Терминал Windows использует GPU для отрисовки текста, что обеспечивает повышенную производительность по сравнению с использованием интерфейса командной строки Windows по умолчанию. Windows Terminal uses the GPU to render its text, thus providing improved performance over the default Windows command line experience.
Поддержка фоновых изображений Background image support
В окне Терминала Windows можно использовать фоновые изображения и изображения в формате GIF. You can have background images and gifs inside your Windows Terminal window. Сведения о добавлении фоновых изображений в профиль см. на странице Профиль — внешний вид. Information on how to add background images to your profile can be found on the Profile — Appearance page.
Аргументы командной строки Command line arguments
Вы можете настроить запуск Терминала Windows в определенной конфигурации с помощью аргументов командной строки. You can set Windows Terminal to launch in a specific configuration using command line arguments. Вы можете указать, какой профиль следует открыть на новой вкладке и какой каталог папки следует выбрать. Кроме того, терминал можно открыть с разделенными панелями и выбрать основную вкладку. You can specify which profile to open in a new tab, which folder directory should be selected, open the terminal with split window panes, and choose which tab should be in focus.
Например, чтобы открыть Терминал Windows из PowerShell с тремя панелями (на левой панели будет запущен профиль Командной строки, а правая панель будет разделена для PowerShell и ваш профиль по умолчанию с WSL), введите: For example, to open Windows Terminal from PowerShell with three panes, with the left pane running a Command Prompt profile and the right pane split between your PowerShell and your default profile running WSL, enter:
Сведения о настройке аргументов командной строки см. на этой странице. Learn how to set up command-line arguments on the Command line arguments page.
How to open console windows
Answered by:
Question
Hi, sorry for english.
I’m beginer in C#.
I wrote a simple C# Windows application. Now I want to redirect all standart output to console window.
So, I must create it and then to set as standart output handler.
When I programmed in C++, I did this at begining of application like next:
.
AllocConsole();
stdout->_file=_open_osfhandle((intptr_t)GetStdHandle(STD_OUTPUT_HANDLE),0);
.
printf(«Hello world!»);
How to do this in C#?
I need something like next:
.
// Here I need opening console window
.
Console .WriteLine(«Hello World!»); // this must be written in console window.
Answers
Here is full example of C# windows application with console window
using System; |
using System.Windows.Forms; |
using System.Text; |
using System.IO; |
using System.Runtime.InteropServices; |
using Microsoft.Win32.SafeHandles; |
namespace WindowsApplication |
< |
static class Program |
< |
[DllImport( «kernel32.dll» , |
EntryPoint = «GetStdHandle» , |
SetLastError = true , |
CharSet = CharSet.Auto, |
CallingConvention = CallingConvention.StdCall)] |
private static extern IntPtr GetStdHandle( int nStdHandle); |
[DllImport( «kernel32.dll» , |
EntryPoint = «AllocConsole» , |
SetLastError = true , |
CharSet = CharSet.Auto, |
CallingConvention = CallingConvention.StdCall)] |
private static extern int AllocConsole(); |
private const int STD_OUTPUT_HANDLE = -11; |
private const int MY_CODE_PAGE = 437; |
static void Main( string [] args) |
< |
Console.WriteLine( «This text you can see in debug output window.» ); |
AllocConsole(); |
IntPtr stdHandle=GetStdHandle(STD_OUTPUT_HANDLE); |
SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true ); |
FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write); |
Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE); |
StreamWriter standardOutput = new StreamWriter(fileStream, encoding); |
standardOutput.AutoFlush = true ; |
Console.SetOut(standardOutput); |
Console.WriteLine( «This text you can see in console window.» ); |
MessageBox.Show( «Now I’m happy!» ); |
> |
> |
> |
All replies
I do not understand why you need a console output in case of windows application.
anywayz, following code may be helpful to you to open and create a command window from the windows application.
Process commandProcess = new Process ();
commandProcess.StartInfo.FileName = «cmd» ;
commandProcess.Start();
Process and ProcessStartInfo belongs to System.Diagnostics namespace, you can set the properties of Process class as per your requirement.
Hope this helps,
Kiran Kotra
I need it for some my debug outputs.
Look what I discovered:
using System.Runtime.InteropServices;
.
[ DllImport ( «kernel32.dll» , EntryPoint = «AllocConsole» , SetLastError = true , CharSet = CharSet .Auto, CallingConvention = CallingConvention .StdCall)]
private static extern int AllocConsole();
.
// very very begining of application
AllocConsole();
Console .WriteLine( «Hello World!» ); // outputs to console window
Only one trouble: AllocConsole must be before any console outputs or all outputs would be placed to standart «hidden» stream.
May be more C# freindly method exists? (DllImport, kernel32.dll looks bad in C#).
Here is full example of C# windows application with console window