Solved I have a general question about powershell, Windows terminal, and command prompt.


andrew129260

Well-known member
Pro User
VIP
Local time
10:17 PM
Posts
1,398
Location
USA
OS
Windows 11 Pro
I always wondered this for a while and I just now decided to ask the question. I found quite a few answers online but I just wanted to see if anyone can break it down better here.

I always found it odd that some commands only work in command prompt while others have to be put into powershell. And then terminal which then theoretically has all of them in to choose from.

It's weird to me that Windows terminal couldn't just identify the command and then switch to the appropriate terminal.

So why is it broken up this way?

I know powershell was created for scripting and stuff but why does older commands have to be put in the command prompt?

For example, I was trying to delete a service and I was doing it in Windows terminal and was wondering why it didn't work and then I remembered I had to use command prompt to do that.

It just makes things confusing
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    Ryzen 7 5700 X3D
    Motherboard
    MSI MPG B550 GAMING PLUS
    Memory
    64 GB DDR4 3600mhz Gskill Ripjaws V
    Graphics Card(s)
    RTX 4070 Super , 12GB VRAM Asus EVO Overclock
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Hard Drives
    2TB Samsung nvme ssd
    2TB XPG nvme ssd
    PSU
    CORSAIR RMx SHIFT Series™ RM750x 80 PLUS Gold Fully Modular ATX Power Supply
    Case
    CORSAIR 3500X ARGB Mid-Tower ATX PC Case – Black
    Cooling
    ID-COOLING FROSTFLOW X 240 CPU Water Cooler
    Internet Speed
    900mbps DOWN, 100mbps UP
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc
Windows Terminal is just a host, a container if you will, for the other shells (cmd, pwsh, powershell, etc.). Terminal doesn't actually process any commands on its own.

Figuring out which command you mean would mostly work, I think, but you'd run into weird ones and chaos would ensue. The one you mentioned is a good example. If you typed 'sc something something' into some theoretical "Figure It Out Terminal," did you mean the sc executable command for configuring services, or sc as in the PowerShell alias for Set-Content. Oh, and that alias only exists in Windows PowerShell. PowerShell does not have it (probably for that reason, I guess).
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4652]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
Thanks. Yeah it looks like this whole time from doing more research I misunderstood what windows terminal was.

I viewed it as an all in one command line tool. Which I guess is true in a way, you can choose from all the command (terminal/shells?) that you want.

I was hoping that if you were using terminal it would just see the command your trying to do and then automatically switch to the right shell/terminal to complete the job.

Such as deleting a service, entering the command in terminal would automatically switch to command prompt to carry out the action. That would be nice.

I am trying to teach the little bit I know to my brother in law who is getting into IT and as I was showing them common commands and such we found it jarring to having to keep switching between them. And having to look up which ones work in which terminal/shell. Luckily the internet exists to guide you on which one to use.

It also doesn't help that since I got hit with this disability my knowledge has become as a gold fish and I am slowing down considerably.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    Ryzen 7 5700 X3D
    Motherboard
    MSI MPG B550 GAMING PLUS
    Memory
    64 GB DDR4 3600mhz Gskill Ripjaws V
    Graphics Card(s)
    RTX 4070 Super , 12GB VRAM Asus EVO Overclock
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Hard Drives
    2TB Samsung nvme ssd
    2TB XPG nvme ssd
    PSU
    CORSAIR RMx SHIFT Series™ RM750x 80 PLUS Gold Fully Modular ATX Power Supply
    Case
    CORSAIR 3500X ARGB Mid-Tower ATX PC Case – Black
    Cooling
    ID-COOLING FROSTFLOW X 240 CPU Water Cooler
    Internet Speed
    900mbps DOWN, 100mbps UP
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc
  • Love
Reactions: OAT
@andrew129260, it might be helpful to set a different color scheme in order to differentiate the shells.

As @pseymour stated, terminal is just a container and has therefore no 'logic' built-in to determine which shell to use.

CMD is an evolution of IBM DOS (Disk Operating System) which at one point was at the core of 16 bit Windows
with config.sys & autoexec.bat to get the whole thing going.
Since NT, It became CMD a stand-alone entity, and is still there for compatibility purposes.
The 2 versions of Powershell came later.

 

My Computers

System One System Two

  • OS
    Windows 11 Pro/All Channels
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    Kingston OM8SEP4512Q 500 GB
    WDS500G2B0A-00SM50 500.1 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & IGB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 13 (Trixie)
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
If you get in the habit of always typing 'sc.exe' instead of 'sc,' you'll have luck in cmd, pwsh and powershell.

Such as deleting a service, entering the command in terminal would automatically switch to command prompt to carry out the action. That would be nice.

Yep, I get what you're saying, but like I said, how would it know? Maybe when you type 'sc,' you mean the service configuration program. Maybe when I type it, I mean 'Set-Content.'
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4652]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
Let's review the history of Windows.

The only console that Windows originally provided was conhost. Both CMD and PS would run inside a conhost session. But you had the same problems as @pseymour outlined: CMD doesn't understand any PS instructions, but PS will consider anything that isn't a native command (or loaded module) as an external task to exec.

"taskkill /f /im explorer.exe" isn't native to PS, so PS just tries exec'ing it. If that attempt fails, PS throws an error.

Great, it runs! Therefore PS is just like CMD!!

Since this "convenience" works so often, naive users often believe a PS shell works exactly the same as CMD. Except for things like how they treat commands with environment variables, and the PS aliases for "dir", "del", "ren" and whatnot are not perfect replicas of their CMD cousins.

The major flaw is Terminal doesn't provide a strong contextual clue to remind you which shell you're in.

The old CMD was in a black window, PS opened in this teal window. And you didn't forget which one was which. But today, Terminal just provides you both shells on a black background without a visual reminder.
 

My Computer

System One

  • OS
    Windows 7
If you get in the habit of always typing 'sc.exe' instead of 'sc,' you'll have luck in cmd, pwsh and powershell.
huh TIL. I just found this too


thank you. Never realized that.

Yep, I get what you're saying, but like I said, how would it know? Maybe when you type 'sc,' you mean the service configuration program. Maybe when I type it, I mean 'Set-Content.'

great point
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    Ryzen 7 5700 X3D
    Motherboard
    MSI MPG B550 GAMING PLUS
    Memory
    64 GB DDR4 3600mhz Gskill Ripjaws V
    Graphics Card(s)
    RTX 4070 Super , 12GB VRAM Asus EVO Overclock
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Hard Drives
    2TB Samsung nvme ssd
    2TB XPG nvme ssd
    PSU
    CORSAIR RMx SHIFT Series™ RM750x 80 PLUS Gold Fully Modular ATX Power Supply
    Case
    CORSAIR 3500X ARGB Mid-Tower ATX PC Case – Black
    Cooling
    ID-COOLING FROSTFLOW X 240 CPU Water Cooler
    Internet Speed
    900mbps DOWN, 100mbps UP
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc
Thanks everyone. Very helpful.

Looks like I have a lot of reading and catching up to do.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    Ryzen 7 5700 X3D
    Motherboard
    MSI MPG B550 GAMING PLUS
    Memory
    64 GB DDR4 3600mhz Gskill Ripjaws V
    Graphics Card(s)
    RTX 4070 Super , 12GB VRAM Asus EVO Overclock
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Hard Drives
    2TB Samsung nvme ssd
    2TB XPG nvme ssd
    PSU
    CORSAIR RMx SHIFT Series™ RM750x 80 PLUS Gold Fully Modular ATX Power Supply
    Case
    CORSAIR 3500X ARGB Mid-Tower ATX PC Case – Black
    Cooling
    ID-COOLING FROSTFLOW X 240 CPU Water Cooler
    Internet Speed
    900mbps DOWN, 100mbps UP
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc
Each shell (cmd.exe, powershell.exe (Windows Powershell) and pwsh.exe(Microsoft Powershell)) all contain built-in functionality, operators etc that are unique to the shell and then they all have access to applications outside of the the shell (basically anything thats an executable stored on a path variable within the shell)

For example in powershell or pwsh you can type this and see those distinctions.
Powershell:
Get-Command -Name * | Group-Object -Property CommandType

Powershell/pwsh do a good job of creating aliases to common commands you might see in cmd and even in Linux
 

My Computer

System One

  • OS
    Linux Mint
    Computer type
    Laptop
    Manufacturer/Model
    System76 Lemur Pro

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4652]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
shells.webp
 

My Computers

System One System Two

  • OS
    Windows 11 Pro/All Channels
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    Kingston OM8SEP4512Q 500 GB
    WDS500G2B0A-00SM50 500.1 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & IGB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 13 (Trixie)
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
These nerd threads are my favorite. Thanks @andrew129260!
anytime. I love creating batch files and messing around in the terminals in general. I am young enough to not have to use dos to run doom, but old enough to still need it for quite a few other things when I was using windows 98 and onward. Winget blows my mind haha so cool. Linux has had package managers for awhile but I will never not be tickled by seeing a color progress bar downloading from the internet in a terminal.

But yeah since this thing has been going on with me my memory has been significantly affected and I am losing touch with everything I used to know which is quite frustrating.

Part of the reason teaching my brother in law has been so invaluable. It helps me retain my thoughts a bit so hopefully I can go back to work once this is figured out.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom Built
    CPU
    Ryzen 7 5700 X3D
    Motherboard
    MSI MPG B550 GAMING PLUS
    Memory
    64 GB DDR4 3600mhz Gskill Ripjaws V
    Graphics Card(s)
    RTX 4070 Super , 12GB VRAM Asus EVO Overclock
    Monitor(s) Displays
    Gigabyte M27Q (rev. 2.0) 2560 x 1440 @ 170hz HDR
    Hard Drives
    2TB Samsung nvme ssd
    2TB XPG nvme ssd
    PSU
    CORSAIR RMx SHIFT Series™ RM750x 80 PLUS Gold Fully Modular ATX Power Supply
    Case
    CORSAIR 3500X ARGB Mid-Tower ATX PC Case – Black
    Cooling
    ID-COOLING FROSTFLOW X 240 CPU Water Cooler
    Internet Speed
    900mbps DOWN, 100mbps UP
  • Operating System
    Chrome OS
    Computer type
    Laptop
    Manufacturer/Model
    HP Chromebook
    CPU
    Intel Pentium Quad Core
    Memory
    4GB LPDDR4
    Monitor(s) Displays
    14 Inch HD SVA anti glare micro edge display
    Hard Drives
    64 GB emmc
  • Like
Reactions: OAT

My Computer

System One

  • OS
    Microsoft Windows 11 Home
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI MS-7D98
    CPU
    Intel Core i5-13490F
    Motherboard
    MSI B760 GAMING PLUS WIFI
    Memory
    2 x 16 Patriot Memory (PDP Systems) PSD516G560081
    Graphics Card(s)
    GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (GV-N4070WF3OC-12GD)
    Sound Card
    Bluetooth Аудио
    Monitor(s) Displays
    INNOCN 15K1F
    Screen Resolution
    1920 x 1080
    Hard Drives
    WD_BLACK SN770 250GB
    KINGSTON SNV2S1000G (ELFK0S.6)
    PSU
    Thermaltake Toughpower GF3 1000W
    Case
    CG560 - DeepCool
    Cooling
    ID-COOLING SE-224-XTS / 2 x 140Mm Fan - rear and top; 3 x 120Mm - front
    Keyboard
    Corsair K70 RGB TKL
    Mouse
    Corsair KATAR PRO XT
    Internet Speed
    100 Mbps
    Browser
    Firefox
    Antivirus
    Microsoft Defender Antivirus
    Other Info
    https://www.userbenchmark.com/UserRun/66553205

Latest Support Threads

Back
Top Bottom