Start at the beginning. Powershell can be run via:
start->run->powershell
Say hello to your new blue and white friend. My hope is to build from post to post and teach what I learn day-to-day as I attempt to migrate from perl scripts to powershell.
Powershell retains the commands that are available in most shells like csh, bash, korn, or DOS. In an effort to attract both *Nix and Windows users powershell is chock full of aliases that will be familiar to both flavors of the IT world. Commands like dir and ls produce the same results, but in reality they are just aliases to a cmdlet called Get-ChildItem. Try typing all three commands in powershell, and you will see that they produce the same results. In order to see a list of all the available aliases try:
get-Alias
This is a great place to start and look at some of the more common commands, but there’s an even more important resource that you need to become familiar with immediately: get-help, man, or just help (mind you help is a function that is equal to get-help, while man is an alias to help). Let’s look up the help page for get-alias:
help get-Alias
Using this we can see everything we need to know about how to look up, and get information about configured aliases in your environment:
get-Alias dir
get-Alias -definition get-ChildItem
get-Alias -definition get*
You’ll notice that one lesson Microsoft learned is to provide proper inline documentation the way *Nix and Perl do. This beginning should provide as a confidence booster that they may have done some things right. I can tell you for certain that there are a lot more surprises in store for you, but we’ll save that for another day. At least you now have a few resources you can use to start learning the ins and outs of Powershell.
Like this:
Like Loading...
Nice post. It’s good to know that unix and windows commands both work, but neither are the native cmdlet. I’ll have to start familiarizing myself with what these aliases are actually calling.
PS – I think ‘get-children’ is ‘get-childitems’.
Ack…. you’re right…. fixing that now
Pingback: Powershell – Part 2: Opening files, writing to the screen, the pipeline, and dot values « Tome's Land of IT
Pingback: Happy Birthday Powertoe! – Tome’s Land of IT « Tome's Land of IT
get-childitem
No plurals on the verb-noun syntax.
what is the difference between help and get-help, really? get-help, by itself, returns a usage, whereas help, by itself, returns a list of aliases. get-alias says that help isn’t an alias, so what is it, separate function?
That’s exactly it. You can see what the help function does by looking at the following:
(Get-Command help -CommandType function).definition