7

How to make Command Prompt, PowerShell, or any Shell launch from the Start Menu...

 3 years ago
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.
neoserver,ios ssh client
How to make Command Prompt, PowerShell, or any Shell launch from the Start Menu directly into Windows Terminal
Sponsored By

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.

PowerShell in the Start Menu

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.

Command Prompt in Terminal

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.

PowerShell in Terminal

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!

Windows Terminal for All

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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK