- Windows Terminal: Changing the Default Shell
- Customize All The Things
- What if I want to modify the default cmd.exe ?
- Callback Insanity
- Is there a way to change the default shell in Windows Terminal?
- 3 Answers 3
- Procedure:
- Windows Terminal: Changing the Default Shell
- Customize All The Things
- What if I want to modify the default cmd.exe ?
- Callback Insanity
- Windows Shell
- Shell Development Scenarios
- Windows Shell SDK Documentation
- Использование средства запуска оболочки для создания терминала на базе Windows 10 Use Shell Launcher to create a Windows 10 kiosk
- Различия между shell Launcher v1 и Shell Launcher v2 Differences between Shell Launcher v1 and Shell Launcher v2
- Требования Requirements
- Включить функцию запуска shell Enable Shell Launcher feature
- Настройка настраиваемой оболочки в MDM Configure a custom shell in MDM
- Конфигурация XML для запуска shell XML for Shell Launcher configuration
- Настраиваемый параметр OMA-URI Custom OMA-URI setting
- Настройка настраиваемой оболочки с помощью PowerShell Configure a custom shell using PowerShell
- действие по умолчанию, настраиваемые действия, код выхода default action, custom action, exit code
Windows Terminal: Changing the Default Shell
Feb 2, 2020 · 4 min read
E very time I open the new Windows Terminal, which I am extremely excited about, by default it opens a PowerShell window. As you probably figured, I am no Windows or Help Desk admin (or at least as of 15 years ago, anyways).
Although I do sometimes do have to use PowerShell to enable one Windows feature or another, Ubuntu WSL is where I ply my trade most of my waking hours. So it would make sense that whenever I opened Windows Terminal, it would open a new Ubuntu WSL session.
If you hav e n’t installed Windows Terminal yet, you can get it from Microsoft’s Window Store (for free). You may or may not need to be running on an edge release of Windows 10.
If you want to contribute to the development of the Windows Terminal, make sure to check out their repository over at Github.
When you open Windows Terminal, open the Settings:
That should open a Notepad.exe window with Windows Terminal settings:
Notice the defaultProfile field at the top: it contains a UUID, or unique identifier. As does each entry under the profiles section.
In my case, the UUID 61c54bbd.. corresponds to the powershell.exe profile.
I am going to change that to c6eaf9f4–32a7… , which corresponds to my Ubuntu WSL profile:
And just like that, next time I open Windows Terminal for the first time, it should open an Ubuntu WSL session instead of PowerShell.
Customize All The Things
Introducing Windows Terminal, by Kayla Cinnamon over at the Windows Command Line development blog (May 6, 2019) contains more details on things you can do with your Windows Terminal.
Go do and check out Kayla’s set of of blog entries, as well as the rest of written by Microsoft’s Command Line team to stay updated about new Windows Terminal features and releases!
If you want to personalize the terminal’s background image or opacity, check out How to change the Windows Terminal background image by Thomas Maurer (September 14, 2019).
Here’s my settings:
Regarding changing the background image, there’s two things that I noted:
- I was not able to apply a global background image and transparency setting (for all terminals). Instead, I had to apply it individually to my WSL profiles. That’s OK with, because it works.
- You CAN use Windows environment variables when specifying the path to your custom background image. Provides for a more flexible setup and a less PII-leaky screenshots (pasted below).
Here’s is the end result:
If you’re curious what I’m using for background, it’s from NASA’s image of the day gallery, which supplies with super high resolution images free of us (they’re taxpayer funded, after all):
What if I want to modify the default cmd.exe ?
The default cmd.exe shell is invoked like so by Windows Terminal:
While in the cmd shell, if you type /? it shows you a list of things that you can do when invoking the shell.
In addition, the prompt command documentation provides further list of options that you can use to customize your prompt.
By chaining the invocation options provided by cmd.exe with the options provided by prompt , you can fully customize what is shown in your command prompt when you open it.
In my case using the following setting for the Windows Terminal:
Yields the following result:
The /K cmd.exe parameter tells the shell to execute the following command without terminating the shell. And by passing prompt to /K I can fully customize the appearance of my prompt.
No more pesky PII (such as your username) being shown on the prompt when I post screenshots of my prompt on my stories, along with some nice swag to go with it.
Callback Insanity
Organic, fair-sourced DevOps and Full-Stack things. This is a BYOB Establishment — Bring Your Own hipster Beard.
Is there a way to change the default shell in Windows Terminal?
When opening the new Windows Terminal, it opens up PowerShell. Also by default new tabs are PowerShell.
You have to manually switch to your desired shell.
Is there a way in the settings JSON file to change this to cmd or something else?
windows version : 1903
3 Answers 3
Open Windows Terminal JSON settings. Next, in profiles array find the object for the shell you’re searching and copy the guid value from it. The last step is to paste this value into the defaultProfile attribute.
It may change your default shell.
The procedure requires some knowledge about JSON file format. Here is a brief outline. Every member is represented as «name»:»value» pair. Arrays use square brackets and Objects use curly brackets. Read this Wikipedia: JSON for more details.
Procedure:
- Open Windows Terminal. Click on the down arrow symbol ˅ from menu bar. This will open a drop down menu from which select Settings option. Alternatively use Ctrl + , to open Settings directly. Here is a sample screenshot:
- After selecting the Settings, Notepad (or the default text editor) will open profiles.json file. Here is a sample, see first JSON object i.e. «globals» .
We are interested in defaultProfile name. The value with 128-bit format <12345678-1234-1234-1234-1234567890ab>is called UUID. Assume its like a nickname for default shell 🙂
Windows Terminal: Changing the Default Shell
Feb 2, 2020 · 4 min read
E very time I open the new Windows Terminal, which I am extremely excited about, by default it opens a PowerShell window. As you probably figured, I am no Windows or Help Desk admin (or at least as of 15 years ago, anyways).
Although I do sometimes do have to use PowerShell to enable one Windows feature or another, Ubuntu WSL is where I ply my trade most of my waking hours. So it would make sense that whenever I opened Windows Terminal, it would open a new Ubuntu WSL session.
If you hav e n’t installed Windows Terminal yet, you can get it from Microsoft’s Window Store (for free). You may or may not need to be running on an edge release of Windows 10.
If you want to contribute to the development of the Windows Terminal, make sure to check out their repository over at Github.
When you open Windows Terminal, open the Settings:
That should open a Notepad.exe window with Windows Terminal settings:
Notice the defaultProfile field at the top: it contains a UUID, or unique identifier. As does each entry under the profiles section.
In my case, the UUID 61c54bbd.. corresponds to the powershell.exe profile.
I am going to change that to c6eaf9f4–32a7… , which corresponds to my Ubuntu WSL profile:
And just like that, next time I open Windows Terminal for the first time, it should open an Ubuntu WSL session instead of PowerShell.
Customize All The Things
Introducing Windows Terminal, by Kayla Cinnamon over at the Windows Command Line development blog (May 6, 2019) contains more details on things you can do with your Windows Terminal.
Go do and check out Kayla’s set of of blog entries, as well as the rest of written by Microsoft’s Command Line team to stay updated about new Windows Terminal features and releases!
If you want to personalize the terminal’s background image or opacity, check out How to change the Windows Terminal background image by Thomas Maurer (September 14, 2019).
Here’s my settings:
Regarding changing the background image, there’s two things that I noted:
- I was not able to apply a global background image and transparency setting (for all terminals). Instead, I had to apply it individually to my WSL profiles. That’s OK with, because it works.
- You CAN use Windows environment variables when specifying the path to your custom background image. Provides for a more flexible setup and a less PII-leaky screenshots (pasted below).
Here’s is the end result:
If you’re curious what I’m using for background, it’s from NASA’s image of the day gallery, which supplies with super high resolution images free of us (they’re taxpayer funded, after all):
What if I want to modify the default cmd.exe ?
The default cmd.exe shell is invoked like so by Windows Terminal:
While in the cmd shell, if you type /? it shows you a list of things that you can do when invoking the shell.
In addition, the prompt command documentation provides further list of options that you can use to customize your prompt.
By chaining the invocation options provided by cmd.exe with the options provided by prompt , you can fully customize what is shown in your command prompt when you open it.
In my case using the following setting for the Windows Terminal:
Yields the following result:
The /K cmd.exe parameter tells the shell to execute the following command without terminating the shell. And by passing prompt to /K I can fully customize the appearance of my prompt.
No more pesky PII (such as your username) being shown on the prompt when I post screenshots of my prompt on my stories, along with some nice swag to go with it.
Callback Insanity
Organic, fair-sourced DevOps and Full-Stack things. This is a BYOB Establishment — Bring Your Own hipster Beard.
Windows Shell
The Windows UI provides users with access to a wide variety of objects necessary for running applications and managing the operating system. The most numerous and familiar of these objects are the folders and files that reside on computer disk drives. There are also a number of virtual objects that allow the user to perform tasks such as sending files to remote printers or accessing the Recycle Bin. The Shell organizes these objects into a hierarchical namespace and provides users and applications with a consistent and efficient way to access and manage objects.
Shell Development Scenarios
The following development scenarios relate to application development:
- Extending the Shell, which consists of creating a data source (versus consuming the Shell data model)
- Implementing a subset of the Shell data source tasks
- Supporting libraries and item views in Windows Explorer
- Using the common file dialog
- Implementing Control Panel items
- Managing notifications
The following development scenarios relate to file format ownership:
- Implementing a subset of the Shell data source tasks
- Implementing any handler
- Supporting desktop search
The following development scenarios relate to data storage ownership:
- Supporting desktop search and OpenSearch
- Implementing a subset of the Shell data source tasks (virtual folders)
- Supporting libraries in Windows Explorer
The following development scenario relates to device support:
- Auto run and auto play
Windows Shell SDK Documentation
This documentation is broken into three major sections:
- The Shell Developer’s Guide provides conceptual material about how the Shell works and how to use the Shell’s API in your application.
- The Shell Reference section documents programming elements that make up the various Shell APIs.
- Shell Samples provides links to related code samples.
The following table provides an outline of the Shell Reference section. Unless otherwise noted, all programming elements are documented in unmanaged C++.
Использование средства запуска оболочки для создания терминала на базе Windows 10 Use Shell Launcher to create a Windows 10 kiosk
Относится к: Applies to
- Windows 10 Ent, Edu Windows 10 Ent, Edu
С помощью оболочки Launcher можно настроить устройство, которое запускает приложение в качестве пользовательского интерфейса, заменив оболочку по умолчанию (explorer.exe). Using Shell Launcher, you can configure a device that runs an application as the user interface, replacing the default shell (explorer.exe). В shell Launcher v1, доступном в Windows 10, можно указать только настольное приложение Windows в качестве оболочки замены. In Shell Launcher v1, available in Windows 10, you can only specify a Windows desktop application as the replacement shell. В windows10 версии 1809 и выше в версии 1809 можно также указать приложение UWP в качестве оболочки замены. In Shell Launcher v2, available in Windows 10, version 1809 and above, you can also specify a UWP app as the replacement shell. Чтобы использовать shell Launcher v2 в версии 1809, необходимо установить обновление KB4551853. To use Shell Launcher v2 in version 1809, you need to install the KB4551853 update.
Shell Launcher управляет приложением, которое пользователь видит в качестве оболочки после входной записи. Shell Launcher controls which application the user sees as the shell after sign-in. Это не мешает пользователю получать доступ к другим настольным приложениям и системным компонентам. It does not prevent the user from accessing other desktop applications and system components.
Методы управления доступом к другим настольным приложениям и системным компонентам можно использовать в дополнение к использованию ракеты-носителя. Methods of controlling access to other desktop applications and system components can be used in addition to using the Shell Launcher. Эти методы включают, но не ограничиваются: These methods include, but are not limited to:
- Групповой политики — пример: предотвращение доступа к средствам редактирования реестра Group Policy — example: Prevent access to registry editing tools
- AppLocker — политики управления приложениями AppLocker — Application control policies
- Управление мобильными устройствами — управление корпоративными политиками безопасности устройств Mobile Device Management — Enterprise management of device security policies
Настраиваемую оболочку можно применить через shell Launcher с помощью PowerShell. You can apply a custom shell through Shell Launcher by using PowerShell. В Windows 10 версии 1803 и более поздней версии можно также использовать управление мобильными устройствами (MDM) для применения настраиваемой оболочки через Shell Launcher. In Windows 10, version 1803 and later, you can also use mobile device management (MDM) to apply a custom shell through Shell Launcher.
Различия между shell Launcher v1 и Shell Launcher v2 Differences between Shell Launcher v1 and Shell Launcher v2
Shell Launcher v1 заменяет оболочку по умолчанию, с помощью которой можно explorer.exe eshell.exe запустить настольное приложение Windows. Shell Launcher v1 replaces explorer.exe , the default shell, with eshell.exe which can launch a Windows desktop application.
Shell Launcher v2 explorer.exe заменяется customshellhost.exe . Shell Launcher v2 replaces explorer.exe with customshellhost.exe . Этот новый исполняемый файл может запустить настольное приложение Windows или приложение UWP. This new executable file can launch a Windows desktop application or a UWP app.
В дополнение к использованию приложения UWP для вашей оболочки замены, Shell Launcher v2 предлагает дополнительные улучшения: In addition to allowing you to use a UWP app for your replacement shell, Shell Launcher v2 offers additional enhancements:
- Вы можете использовать настраиваемые приложения для рабочего стола Windows, которые затем могут запускать приложения UWP, такие как Параметры и сенсорная клавиатура. You can use a custom Windows desktop application that can then launch UWP apps, such as Settings and Touch Keyboard.
- Из пользовательской оболочки UWP можно запускать вторичные представления и запускать на нескольких мониторах. From a custom UWP shell, you can launch secondary views and run on multiple monitors.
- Настраиваемая оболочка приложения выполняется на полном экране и может запускать другие приложения на полном экране по требованию пользователя. The custom shell app runs in full screen, and can run other apps in full screen on user’s demand.
Примеры конфигураций XML для различных комбинаций приложений см. в примере Примеры для shell Launcher v2. For sample XML configurations for the different app combinations, see Samples for Shell Launcher v2.
Требования Requirements
Windows 10 не поддерживает настройку пользовательскую оболочку до запуска при первом включении компьютера. Windows 10 doesn’t support setting a custom shell prior to OOBE. Если вы поддерживаете эту функцию, вы не сможете развернуть полученный образ. If you do, you won’t be able to deploy the resulting image.
Средства запуска оболочки не поддерживают пользовательскую оболочку с приложением, которое запускает другой процесс и затем завершает работу. Shell Launcher doesn’t support a custom shell with an application that launches a different process and exits. Например, нельзя указать write.exe в средстве запуска оболочки. For example, you cannot specify write.exe in Shell Launcher. Средство запуска оболочки запускает пользовательскую оболочку и отслеживает процесс для идентификации завершения работы пользовательской оболочки. Shell Launcher launches a custom shell and monitors the process to identify when the custom shell exits. Write.exe создает 32-разрядный процесс wordpad.exe и завершает работу. Write.exe creates a 32-bit wordpad.exe process and exits. Поскольку средство запуска оболочки не распознает созданный процесс wordpad.exe, средство запуска оболочки будет действовать в соответствии с кодом завершения Write.exe, например перезапуск пользовательской оболочки. Because Shell Launcher is not aware of the newly created wordpad.exe process, Shell Launcher will take action based on the exit code of Write.exe, such as restarting the custom shell.
Домен, Azure Active Directory или учетная запись локального пользователя. A domain, Azure Active Directory, or local user account.
Приложение Windows, установленное для этой учетной записи. A Windows application that is installed for that account. Можно использовать собственное приложение вашей компании или стандартное приложение типа Internet Explorer. The app can be your own company application or a common app like Internet Explorer.
Включить функцию запуска shell Enable Shell Launcher feature
Чтобы настроить настраиваемую оболочку, сначала включите функцию Запуска оболочки, а затем можно настроить настраиваемую оболочку в качестве настраиваемой оболочки по умолчанию с помощью PowerShell или MDM. To set a custom shell, you first turn on the Shell Launcher feature, and then you can set your custom shell as the default using PowerShell or MDM.
Включение средства запуска оболочки в компонентах Windows To turn on Shell Launcher in Windows features
Откройте «Панель управления» > Программы и компоненты > Включение или отключение компонентов Windows. Go to Control Panel > Programs and features > Turn Windows features on or off.
Разверните узел Блокировка устройств. Expand Device Lockdown.
Выберите Средство запуска оболочки и нажмите кнопку ОК. Select Shell Launcher and OK.
Кроме того, вы можете включить запуск оболочки с помощью конструктора конфигурации Windows в пакете подготовка, с помощью средства обслуживания и управления изображениями развертывания SMISettings > ShellLauncher (DISM.exe). Alternatively, you can turn on Shell Launcher using Windows Configuration Designer in a provisioning package, using SMISettings > ShellLauncher , or you can use the Deployment Image Servicing and Management (DISM.exe) tool.
Включение средства запуска оболочки с помощью DISM To turn on Shell Launcher using DISM
Откройте окно командной строки от имени администратора. Open a command prompt as an administrator.
Введите следующую команду. Enter the following command.
Настройка настраиваемой оболочки в MDM Configure a custom shell in MDM
Для настройки запуска shell в MDM можно использовать XML и настраиваемый параметр OMA-URI. You can use XML and a custom OMA-URI setting to configure Shell Launcher in MDM.
Конфигурация XML для запуска shell XML for Shell Launcher configuration
Следующий пример XML работает для Shell Launcher v1: The following XML sample works for Shell Launcher v1:
Для shell Launcher v2можно использовать тип приложения UWP, указав пространство имен v2, и указать тип, как показано в Shell следующем v2:AppType примере. For Shell Launcher v2, you can use UWP app type for Shell by specifying the v2 namespace, and use v2:AppType to specify the type, as shown in the following example. Если v2:AppType не указано, это означает, что оболочка — это приложение Win32. If v2:AppType is not specified, it implies the shell is Win32 app.
В XML для shell Launcher v2 обратите внимание на атрибут AllAppsFullScreen. In the XML for Shell Launcher v2, note the AllAppsFullScreen attribute. При наборе Trueзапуск оболочки будет запускать каждое приложение на полном экране или максимально использовать для настольных приложений. When set to True, Shell Launcher will run every app in full screen, or maximized for desktop apps. Если этот атрибут заданной для False или не заданной, только настраиваемая оболочка приложения запускается на полном экране; другие приложения, запущенные пользователем, будут работать в окне. When this attribute is set to False or not set, only the custom shell app runs in full screen; other apps launched by the user will run in windowed mode.
Настраиваемый параметр OMA-URI Custom OMA-URI setting
В службе MDM можно создать настраиваемый параметр OMA-URI для настройки shell Launcher v1 или v2. In your MDM service, you can create a custom OMA-URI setting to configure Shell Launcher v1 or v2. (XML, который используется для настройки, определит, применяет ли вы shell Launcher v1 или v2.) (The XML that you use for your setting will determine whether you apply Shell Launcher v1 or v2.)
Путь OMA-URI является ./Device/Vendor/MSFT/AssignedAccess/ShellLauncher . The OMA-URI path is ./Device/Vendor/MSFT/AssignedAccess/ShellLauncher .
Для значения можно выбрать тип данных и ввести необходимое содержимое файла String конфигурации в поле значения. For the value, you can select data type String and paste the desired configuration file content into the value box. Если вы хотите загрузить xml вместо вклейки контента, выберите тип String (XML file) данных. If you wish to upload the xml instead of pasting the content, choose data type String (XML file) .
После настройки профиля, содержащего настраиваемый параметр запуска оболочки, выберите Все устройства или выбранные группы устройств для применения профиля. After you configure the profile containing the custom Shell Launcher setting, select All Devices or selected groups of devices to apply the profile to. Не назначайте профиль пользователям или группам пользователей. Don’t assign the profile to users or user groups.
Настройка настраиваемой оболочки с помощью PowerShell Configure a custom shell using PowerShell
Сценарии для Shell Launcher v2 см. в примере сценариев WMI моста Shell Launcher v2. For scripts for Shell Launcher v2, see Shell Launcher v2 Bridge WMI sample scripts.
Для shell Launcher v1 измените следующий сценарий PowerShell по мере необходимости. For Shell Launcher v1, modify the following PowerShell script as appropriate. Комментарии в примере сценария поясняют назначение каждого раздела и подсказывают, где следует изменить сценарий для ваших целей. The comments in the sample script explain the purpose of each section and tell you where you will want to change the script for your purposes. Сохраните сценарий с расширением .ps1, откройте Windows PowerShell от имени администратора и запустите его на устройстве в режиме терминала. Save your script with the extension .ps1, open Windows PowerShell as administrator, and run the script on the kiosk device.
действие по умолчанию, настраиваемые действия, код выхода default action, custom action, exit code
Пусковая компания Shell определяет 4 действия для обработки выходов приложений, можно настроить пусковую статью оболочки и использовать эти действия на основе другого кода выхода. Shell launcher defines 4 actions to handle app exits, you can customize shell launcher and use these actions based on different exit code.
Значение Value | Описание Description |
---|---|
0 0 | Перезапуск оболочки Restart the shell |
1 1 | Перезапуск устройства Restart the device |
2 2 | Отключение устройства Shut down the device |
3 3 | Ничего не делать Do nothing |
Эти действия можно использовать в качестве действия по умолчанию или можно соедеть с определенным кодом выхода. These action can be used as default action, or can be mapped to a specific exit code. Обратитесь к пусковике Shell, чтобы узнать, как эти коды с WMI запуска shell Launcher. Refer to Shell Launcher to see how these codes with Shell Launcher WMI.