How to make Command Prompt, PowerShell, or any Shell launch from the Start Menu...
source link: https://www.hanselman.com/blog/how-to-make-command-prompt-powershell-or-any-shell-launch-from-the-start-menu-directly-into-windows-terminal
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
I love the Windows Terminal, but right now I launch the Terminal, then I pick a Shell (PowerShell, CMD, bash, etc) from the menu. Sometimes I want to be "shell-first."
I'll hit the Start Menu, type cmd, and then the older console/terminal starts up. I have to remember to run Terminal THEN run cmd. So I said to myself, "self, what's a good way to fix that?"
When you press Start and start typing (which is different from WinKey+R and running a .exe directly) you're looking at Shortcuts/LNK files. You can make your own and change existing ones.
Press Start, type "Command Prompt" or "PowerShell" and then RIGHT CLICK the icon and Open File Location.
For example, Command Prompt was here on my machine:
C:\Users\scott\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools
So I Ctrl+C, Ctrl+V to make a copy (backup) or I can just right click and hit properties to change the one I have.
Then I change the Target to wt.exe (Windows Terminal) and pass in the Named Profile for the Shell I want:
C:\Users\scott\AppData\Local\Microsoft\WindowsApps\wt.exe -p "Command Prompt"
In this case, it's Command Prompt. I also renamed my LNK file to Command Prompt (Terminal) but that's optional.
I can do the same thing for PowerShell. I've moved to open source PowerShell 7 (based on .NET Core) that I installed from the Windows Store. Some store apps don't want you to change their icons so I just changed another. You can also make your own with right-click, New Shortcut.
I even did this with the Visual Studio 2019 Developer Prompt by first making a Profile for it in my Terminal settings:
{
"commandline"
:
"C:\\WINDOWS\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe -noe -c \"&{Import-Module \"\"\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"\"\"; Enter-VsDevShell 4f53a196}\""
,
"guid"
:
"{61c54bbd-c2c6-5271-96e7-009a87ff45ce}"
,
"hidden"
:
false
,
"name"
:
"VS2019 Dev Prompt"
,
"startingDirectory"
:
"%USERPROFILE%"
},
and then changing the icon to call it with wt.exe and the named profile. This can also work with Cygwin, Yori, Ubuntu, or any other shell.
A few minutes and a few shortcut changes later, now I can hit start, type PowerShell, command, cmd, whatever, and it'll all load in Windows Terminal!
Since this technique works only with lnk files that the Start Menu consumes, it also works with PowerToys Run (which is like Quicksilver or Spotlight on Mac)!
Hope this helps!
Sponsor: The No. 1 reason developers choose Couchbase? You can use your existing SQL++ skills to easily query and access JSON. That’s more power and flexibility with less training. Learn more.
Recommend
-
37
A month ago, I wrote a blog on how you can configure the MySQL Shell prompt to suit your needs. One thing I did not go into details w...
-
6
I often ask “What time did I run that command?” For a long time I couldn’t find out quickly and accurately. It seems easy to do with other shells, but I couldn’t find a way to do it with Bash, so I cooke...
-
9
Colorez votre shell prompt Ubuntu ps1 shell prompt...
-
18
Taking your PowerShell prompt to the next level with Windows Terminal and Oh my Posh 3 Sponsored By I love
-
10
Developer PowerShell Core Prompt in Visual Studio Code Integrated TerminalVisual Studio recently got a new Developer Powe...
-
11
You should be customizing your PowerShell Prompt with PSReadLine Sponsored By I use PowerShell 7 (cross platform, open source...
-
5
Do Not Use '>' in Your Command Prompt (and How to Stay Safe in Shell) Do Not Use '>' in Your Command Prompt (and How to Stay Safe in Shell) 2021-03-16 Over the years of troubleshooting performance problem...
-
11
My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal Sponsored By I've long blogged about my love of setting up a nice terminal, getting
-
7
How to make vim execute a shell command without blocking the screen advertisements I recently switched to using...
-
7
PowerShell vs. Command Prompt: Which One Should You Use?PowerShell vs. Command Prompt: Which one to use? This article compares...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK