What is PowerShell? How it differs from Command Prompt (cmd)?

0

Though Windows is an operating system which does not much rely on text commands, But still there is a command line available in the Windows from the starting. We all know that as DOS. If you have notce recently Microsoft introduce a new command line ‘PowerShell’ which looks a like DOS or CMD. But it is more powerful then DOS.

What is powershell. Diferrence between powershell and command prompt

PowerShell

Powershell is an advanced version of the command prompt. You can create own command and scripts in the PowerShell using the C#. C# and PowerShell both are well integrated with the .Net framework.

Features of the PowerShell

Below are the features which differ it from the command prompt and make it powerful command line.

Package Management

As like in the Linux now in Windows as well we can download the available packages from the repositories. It make it easy to manage packages in download, install and remove. Now no need to visit different websites to download the packages.

Secure Shell (SSH)

The is also one of the most useful feature introduced by the Windows in Powershell. Now we can establish a secure connection over SSH to other machines. Before this a third party software was used to do this. Most popular third party software used for this was Putty.

Other features are:

  • Remote execution of the tasks.
  • Tasks in the background.
  • Command Piping.

How to run PowerShell

There are 3 common methods to start powershell.

1) PowerShell can be run from the Run window by typing command “powershell”.

2) Or in Windows 10, Right click on the Start Button and select one of the option : Windows Powershell (admin) or Windows powershell. Windows Powershell (Admin) run the powershell as an administrator.

Windows Start button context right click menu

3) Third method to start the powershell is within Command Prompt itself. You can just type the powershell and hit enter. A PS C:\> shows that now you are in powershell mode. You can type Exit to switch back to the command prompt.

Run Powershell in Command Prompt

FAQ

Q: Why we need a command line in Windows?

A: Mostly all of the tasks can be done with the graphical interface in Windows but sometime still we need command line interface specially for power users or to troubleshoot Windows. Microsoft firstly introduced the DOS (command.com) and then they improve it as the command prompt (cmd.exe) and after that PowerShell command interpreter came into the existence. It is much powerful then the command prompt.

Q: Can we run the DOS commands in powershell?

A: Simple answer for this is ‘Yes’. Actually powershell commands are different then the cmd commands . Cmdlets are used in powershell. But with the help of aliases it can be possible. Aliases run the equivalent cmd command. See the below example to list files in the directory.

DOS: dir
Powershell: Get-ChildItem

Use the command Get-Alias to check the equivalent dos commands available as an alias.

Q: Can we run powershell commands in cmd?

A: Simple answer for this is ‘Yes’. Actually you can’t run the powershell command in dos but you can initiate the powershell command line within the DOS. ANd after that you can run the powershell commands.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More