PowerShell and Command Prompt on Windows

Before starting, I would like to mention the link for the reference video:

Windows has two command shells: The Command Prompt and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations. Command prompt and windows PowerShell are two similar ideas but PowerShell is more advanced.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets . Cmdlets (🗣Command lets) are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in PowerShell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

PowerShell not only refers to program you run on windows, it actually refers to whole a scripted programming language called PowerShell.

Short explanation:- Command Prompt is extremely limited to getting and running commands, whereas in PowerShell, being a programming language, you can set variables, make functions, carry out operations etc.

Running basic algebric commands using the PowerShell scripting language
Example: running basic mathematical operations with variables in PowerShell

Here, the variable is defined in the format: $variable_name = value.

cmdlets are more advanced functions made by Microsoft natively in the PowerShell.

Features of commands in PowerShell:

  • PowerShell cmdlets use a consistent verb-noun structure, where the verb represents the action and the noun represents the object to operate on. Example: Set-Location
  • Due to alias between command prompt and PowerShell, pretty much all the old commands in command prompt do the exact thing in PowerShell, if you type cd in PowerShell, here it will automatically assign that cd=Set-Location and function well.
  • Imp: A lot of these commands you use in PowerShell might not even be commands at all because a lot of them are not commands but rather programs in the system32 folder in windows. For example: Ping command runs the PING.exe which is in system32 folder, same goes with ipconfig etc.
  • get-command gives info about other used commands
get-command’s output
  • get-alias gives the list of all aliases between command prompt, Linux bash and PowerShell.
get-alias command result (a)
get-alias command result (b)
get-alias command result (c)
get-alias command result (d)
  • PowerShell uses pipes ( | )to pipe data from one command into the other.
  • PowerShell can produce output in form of objects rather than strings.
  • Command Prompt is also able to do scripts using batch files but PowerShell uses ps1 files as the script extension.

So, these were some basic differences and the power of PowerShell. For, the table of basic PowerShell commands, you can refer to the following link:

Thank You!

--

--

--

A girl who is learning to code…..

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fix cast tab from Chrome to TV freeze for Windows

How Zestmoney’s Risk Engine became 5xx/499 free.

Kotlin tips: Singleton, Utility Functions, group Object Initialization and more…

Mac Software Raid 0 Performance

Text2Speech in Golang sdk provided in IBM Watson.

Kotlin — Mastering generics nullability

Introduction to Matplotlib — Part 1

ADAMoracle Brand Upgrade , Combine Vision and Value.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Taranpreet Kaur

Taranpreet Kaur

A girl who is learning to code…..

More from Medium

Medical Diagnosis App Development: Types, Benefits, and Use Cases

My Tech Journal: Day 2 and Day 3

10 Slang Words You Need To Know in 2022

Top 4 Tasks to Automate with Web Automation