Why are there multiple types of command line interfaces in windows rather than just one? Command prompt, Powershell etc.

659 views

Why are there multiple types of command line interfaces in windows rather than just one? Command prompt, Powershell etc.

In: Technology

3 Answers

Anonymous 0 Comments

Powershell is the NEW command prompt.

Cmd really only lets you run – from a dos prompt – the applications in your path (environment variable) or in the local folder which you normally could run by finding the executable in Windows Explorer.
You can “script” cmd by using batch files, but DOS/Windows .bat file syntax essentially is just what you could type line by line in a cmd window, nothing more. In order to interact with files, system parameters, registry values or running applications you’d have to write a cmd executable program to do so.

Powershell on the other hand does everything cmd does, but includes support for plugins and scripting – if you like, its very similar to a UNIX/Linux style “shell” – it can launch programs, interact with running programs, can be scripted and provides APIs to maniupulate files, parse file contents etc.

if you ever find yourself cursing while you attempt to troubleshoot a complex .bat file, seriously look into Powershell scripting. So much nicer.

Anonymous 0 Comments

There’s just those two.

Command Prompt is the old interface. It’s a lot simpler than Powershell so it’s easier to work with if you’re only doing basic things. It also still exists for backwards compatibility.

Powershell is much more powerful, but much more complicated.

Anonymous 0 Comments

The command prompt is basically the backwards compatible prompt that goes all the way back to the first MS DOS.

It has a lot of baggage of stuff that made sense once upon a time or doesn’t make sense but nobody saw it at that time and generally carries around with it a history of almost 40 years.

A lot of things that are relatively easy in your average Linux BASH shell are extremely awkward in a CMD BAT. You can still do them, you just won’t have much fun while doing it.

Instead of changing the CMD prompt and breaking comparability Microsoft invented a new prompt called power-shell.

The power-shell is basically the windows framework that windows is based on in a script form.

It is object oriented and wells structured and generally designed with some thought given to it. Where in CMD everything was text, in PS you just have objects.

You can still call on all the old CMD programs like ipconfig from the PS prompt, but you are supposed to use the relevant PS equivalents.

It makes scripting things much easier on windows.