Change default shell windows

Changing the default Windows Shell in Windows 7

The default Windows shell in Windows 7 is the Windows Explorer, however you can replace it with other shells such as, the command prompt, Windows PowerShell or custom built shells. This may become handy when computers are running specific tasks and you want to restrict their usage or free up resources taken by the default shell. However, remember that if for example you set the command prompt as the default shell, users can still load the default shell and other hidden applications.

Plan ahead before changing the default Windows shell as it may not be easy to revert back and render your computer unusable. For instance, to run the registry editor from the command prompt, type regedit or to log off, type logoff. Furthermore, Microsoft doesn’t support custom built configurations.

To start the registry editor, type regedit in the Start menu search text box and press enter.

In HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon edit the string Shell by replacing Explorer.exe to cmd.exe for instance. You need to log off and back on to see the change.

Key: HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name: Shell
Type: REG_SZ
Value: [Explorer.exe or Cmd.exe or PowerShell.exe or others]

A word of caution – incorrectly editing the registry may severely damage your system. The above modifications are intended for Windows knowledgeable users who are familiar with the registry editor. Users are also reminded to take a backup of the registry before making any critical changes.

Be the first to comment — What do you think? Posted by George — November 5, 2011 at 9:59 am

Set and use Zsh as default shell in WSL on Windows 10 the right way

Jun 25, 2017 · 2 min read

A few months ago, I wrote an article to show how to get Zsh in WSL on Windows 10. But I haven’t exactly shown how to make it the default shell. In facts, you can’t (not the “official” way anyway), because bash.exe in System32 folder is meant to call bash shell, not zsh. So no matter how you try to set zsh as the default shell through chsh -s $(which zsh) , it doesn’t work if you still call to bash.exe everytime you use WSL.

Читайте также:  Ntp local server linux

Knowing this, th e WSL team has made some changes. In the recent Windows 10 Insider builds for Windows 10 Fall Creator Update, there’s a wsl.exe file in System32 which performs two functions according to a member of the WSL team:

  1. When run without arguments, it will launch your default user’s default shell (which is configurable via the chsh command).
  2. When run with arguments, it is an easy way to run a specific Linux binary (wsl.exe ls).

So that means you can actually use the true default shell now if you call to wsl.exe instead of bash.exe. Here’re examples, Hyper Terminal and Visual Studio Code. First of all, you have to set zsh as the default shell, (obviously). Type this to the current WSL terminal you’re using (like “Bash on Ubuntu on Windows”)

Now back to Hyper, edit the settings file where the shell and shellArgs options are like this:

That’s Hyper, how about Visual Studio Code? It’s the same. Just change “bash.exe” to “wsl.exe” in the settings file

There we go! Everything should work fine now.

How to Change the Windows Terminal Default Shell Profile

The Windows Terminal is now generally available as version 1.0. I already shared a blog post on how to customize the Windows Terminal and shared my personal settings.json file with a lot of different examples, like the integration of PowerShell Remoting, SSH Remoting, changing the background image and much more. One question I got is, how to change the Windows Terminal default shell or default profile from PowerShell to the Windows Subsystem for Linux (WSL) or the command line (cmd).

By default, the Windows Terminal takes PowerShell 7 (if it is installed) as the primary shell when you open the Windows Terminal. However, if you want to change that you can simply configure the default shell in Windows Terminal, in the settings.json file. On the top, you can find the “defaultProfile” setting with a GUID

The GUID is the GUID of your profile. For example, if you want to change it to cmd, you can use the following GUID “0caa0dad-35be-5f56-a8ff-afceeeaa6101”.

Windows Terminal settings.json

I hope this blog post gives you a look on how to switch the default shell in Windows Terminal. I recommend that you check out my other blog post where I share even more details on how to customize the Windows Terminal. You can also read the full announcement blog for the version 1.0 here or check out the documentation on Microsoft Docs.

If you have any questions, feel free to leave a comment.

Читайте также:  Boot wim windows setup

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:

  1. 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.
  2. 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 🙂

Оцените статью