Powershell vs cmd: What is the difference between Powershell and cmd? Which one you should use in 2020?

Powershell vs cmd

powershell vs cmd
powershell vs cmd

windows command prompt and blue command prompt also known as powershell. Powershell vs cmd, what are the differences? well, they’re both share the same idea but what’s the point of having two same program in your Computer? The very short answer is, although they are used for same purpose, but powershell is just more advanced and more powerful then cmd. By the way, cmd and command prompt are refers to the same.

Though, the answer is state forward still we understand the difference between these two program and why you might want to use powershell over command prompt. Should you even bother learning powershell? Well, there are a lot of advantages in powershell actually and it is way more powerful.

Powershell vs cmd: Command shell overview

First let’s actually just take a look at what microsoft itself says is the difference between Powershell vs cmd.

Now don’t worry if you don’t understand a lot of that. You don’t know what the heck is cmdlets. I’m going to get into that later in this article and make it easy to understand. Basically the only thing you need to understand at this point is that powershell can do pretty much everything the command prompt can do. It can run pretty much all the commands the cmd can run. But powershell can do some extra more thing.

If you’re familiar with both then there’s really no reason to not just use powershell for everything because it can do everything with the same commands as cmd can. But of course if you’re familiar with only command prompt then you’re not going to be using anything in powershell, may be worth it to learn some powershell commands.

Powershell vs cmd: Powershell is a scripting language

Another very important thing you need to know is that powershell does not just refer to the powershell program that you run in windows. It is refers to an actual scripting programming language also called powershell.

Whereas the command prompt or cmd pretty much just a old legacy environment for dos commands just for backwards compatibility. It is still here just because a lots of people still used it and more familiar with it. But command prompt is extremely limited.

You see with the command prompt you type a command, it runs the command and that’s pretty much all.

Whereas with powershell, because it’s an entire language and the powershell program supports the powershell scripting language, you can actually able to do so much extra stuff like you do with a programming language right in the powershell window.

powershell scripting language
powershell vs cmd

So you for example could set variables, create a function do all this right through the powershell window. Which with is not something you can do with command prompt. You just basically type in commands in the command prompt.

Whereas with powershell you could do all sorts of different weird stuff and just right through that window.

Read more: Gaming PC Build Under 50000 Rs In India 2020

Powershell vs cmd: Powershell has “cmdlets”

Now i mentioned before that powershell is more powerful than command prompt but what do I mean by that? So both command prompt and powershell are capable of taking control over the operating system, changing settings that sort of thing.

But powershell can do just way more settings than command prompt. And like I said because command prompt is just a legacy environment. Powershell is what microsoft has been working on since windows 7 as the main command shell to be used for everything.

So anytime they add a new setting that they want to be changed by a command shell it’s obviously going to be used in powershell. So it can do way more, whereas command prompt just gets more outdated by the day.

Now both command prompt and powershell have just basic commands like showing a directory or changing directory, super basic stuff for interacting with the shell, deleting files etc.

But the difference is powershell also has these “cmdlets”, which are more advanced functions created by microsoft and then put in into powershell.

It might seem intimidating at first because the commands in powershell are all different from command prompt. But that’s not exactly the case because they basically created “Alias” which make the old commands do the same thing as the new commands.

Powershell vs cmd: Powershell support “Alias”

All the commands in powershell from my understanding have a certain structure. So it’s a verb noun structure. For example “Set-Location”, it’s a verb and then a noun. And all the commands are going to look like this.

powershell set-location
powershell vs cmd

However that doesn’t necessarily mean that if you’re already familiar with command prompt or even the Linux bash, that you have to learn all of these new commands and memorize them just to be able to use powershell.

With the support of “Alias” which basically just a link that says, okay if someone types in “cd” for change directory in command prompt, that is going to link to the set location command in powershell. “cd = Set-Location”.

It’ll do the exact same thing. So pretty much all of the old command prompt commands do the exact same thing in powershell. You don’t have to learn the new powershell command at all.

And another really important thing to remember is that a lot of these command prompt commands you’re probably familiar with are might not even be commands at all.

A lot of them are not commands but rather programs in the system 32 folder in windows. For example when you run the ping command, it’s not exactly a command. You’re actually running “ping.exe” that’s in the system 32 folder.

ping.exe
chkdsk
ipconfig
powershell vs cmd

For other common programs like “chkdsk“, “ipconfig” and more. These are all actual “.exe” programs in the system 32 folder that you’re running. They’re not just exclusive commands to command prompt. So if you type these commands into the powershell it’ll do the same exact thing.

Powershell vs cmd: Getting more info about commands

You can even see this when you look up the info in powershell about each individual command. So you can actually use “Get-Command” as a command to look up another command. It’ll tell you info about it.

So if you type “Get-Command ping” it says command type is an application and it points to “ping.exe”. Another example for an “alias“, if you type “Get-Command cd” you get information about this command.

powershell command
powershell vs cmd

If you want to see them all you can just type “Get-Alias” and see all the aliases that exist. But if you do this you’ll probably notice that not all of these aliases are command prompt commands, some of them are actually Linux bash commands.

So yes if you’re familiar with the Linux bash command already then you again do not have to learn any of these new commands you can just use the alias for the existing bash command that you’re already familiar with and it’ll do the same exact thing.

For example the “ls” command which lists directory contents that also is an alias for the “Get-ChildItem”.

Read more: PS5 vs Xbox series X | The Best Next Generation Console

Powershell vs cmd: Pipe system in Powershell makes life easier

Now I already mentioned how there’s a lot more functions and stuff that powershell can do. But also how you actually work with these commands in powershell is a lot easier and different than in command prompt.

That’s because powershell uses what are called pipes to pipe data from one command into the other and let me explain what that even means.

So with command prompt you probably know you basically just type in a command, it’s all text, as a string of text and then the command prompt will output a bunch of text as the output. And if you want to use that output from a command prompt command, as it’s just a string of text you either have to copy it and then put it into a new command separately.

But with powershell you can actually take the output from one command and pipe it directly into the input of another command.

That’s because instead of powershell getting outputs in the form of just a string of text that you have to basically parse out or separate out and get the exact amount, powershell actually can output results in an “object”.

Powershell vs cmd: Powershell creates object as output

So, what is an object? Instead of it being a long string of all the text, the data is separated out into chunks that are kind of labeled in a way behind the scenes that the programming language can interpret and much easier get out the data exactly what it needs.

So the consequence of this like I mentioned, is that powershell can take that object or organized information from the output of one command and put it directly into another command.

Without having to do any other extra work and the new command will automatically know how to take the part of the original output that is needed for this new command. And it can just ignore whatever it else it doesn’t need.

Whereas you would have to specifically yourself pick out the information, if it was just a string output like command prompt. So it’s way easier to do much more complex series of commands with powershell, if you need to.

Powershell vs cmd: Scripts

Now let’s talk about scripts though. Because I also mentioned that powershell is also the name of the scripting language of the same program. But command prompt also is able to do scripts using what are called batch files.

Powershell uses “ps1” files as the script extension. And there should be no surprise here that batch files are way more limited than powershell scripts.

For example, in batch scripts you can’t even use “nested if statements”. It can only be one “if statement” at a time and if you want it to be another one you have to use the “Goto” command.

So you have all these random parts of code at different points in the file and then you have to go to each one and it ends up just being spaghetti code bouncing all over the place, hard to figure out what’s going on, it’s a pain.

Whereas In powershell as it’s a scripting language you have nearly all the features a programming language have. So the powershell script ended up being a lot more organized and will be a lot easier to modify in the future.

Powershell vs cmd: Others difference

There’s also some other oddities that you’ll probably have to get used to. For example, if you want to run an “.exe” file from the Powershell program, you can’t just type the name of the “exe” file like you can a command prompt.

Even if you’re in the same directory you have to type “./” to show that you want to use the current directory and then the “exe” file. Because for some any reason powershell doesn’t assume that you want to run the file in the current directory it’s in. So that’s just one thing you have to keep in mind.

powershell exe run
powershell vs cmd

So overall if you’re just using the most bare bones basic commands in cmd and that is all you’ll ever use, I mean yeah you can just use command prompt and not miss anything in powershell.

But I would still suggest at least getting a little bit familiar with powershell so that you might realize in the future that there is something you can do with powershell that you never would have thought was even possible in command prompt. So then you’ll at least know, and then you can keep using the same commands in powershell anyway.

2 thoughts on “Powershell vs cmd: What is the difference between Powershell and cmd? Which one you should use in 2020?”

  1. Pingback: 9 Best Linux distro for gaming in 2020 | Gaming on Linux

  2. Pingback: liquid cooling vs air cooling - Which is better in 2020

Leave a Comment

Your email address will not be published. Required fields are marked *