Thursday, 13 August 2015

About The Console

Starting from windows 7 and 2008 R2, PowerShell is installed by default. If you need windows PowerShell in older systems, You have to download and install it. It is included in WMF(Windows Management framework).
After installing PowerShell, you can find it by just clicking start(Windows 7 or later) and by typing 'PowerShell' or you can find it in c:\windows\system32\WindowsPowershell\v1.0\powershell.exe.

The best way is to use the 'Run'(Windows Key + R) and by typing PowerShell and hit enter. If you want to use PowerShell with elevated privileges, You should right click the icon and should select. 'Run As Administrator' option.

After PowerShell starts, You will get a Blue console with a cursor blinking.



As all programming language, Which starts by experimenting using 'HelloWorld'.
Just type HelloWorld and hit enter.

You will get error as 'Helloworld : The term 'Helloworld' is not recognized as the name of a cmdlet ...', Because PowerShell doesn't know what HelloWorld is.

For most of the console like cmd.exe , terminal etc. will have a help command. Here in PowerShell also we have the same.
Type 'help' and hit enter.

But, Here in PowerShell , we have a common structure for cmdlets.
it is a combination of a Verb and a Noun with a '-' in between.

Get-Help

Get-Help is the command that shows the help for each cmdlets. Here you typed help in the console and got output for the actual Get-Help cmdlet. Why because , we have 'Alias' for some cmdlets in PowerShell, If not we have the option to create one using New-Alias cmdlet.
help/man are the aliases for Get-Help cmdlet.

As in cmd.exe we have the option too break a running cmdlet by using Ctrl + C combination or by using Ctrl + Break combination.

After all , You may find that some of the commands in cmd.exe will work in PowerShell as well, But its not "some" , But its "most". Most of the commands in cmd will work in PowerShell as well as they are standalone executables.
ping ,ipconfig, netsh, net, md, chdir, dir are some of them.





No comments:

Post a comment