Windows PowerShell : Variables, Types, and Operators
- Posted: Sep 15, 2009 at 8:44 AM
- 56,613 Views
- 5 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- WMV (WMV Video)
- MP3 (Audio only)
- MP4 (iPod, Zune HD)
- Mid Quality WMV (Lo-band, Mobile)
Join James Brundage, PowerShell Test Team SDE, as he introduces Variables, Types, and Operators.
Windows PowerShell is a Windows command-line shell designed for ease-of-use not only by system administrators but also for application and system developers. The shell includes an interactive prompt and a scripting environment that can be used independently
or in combination. PowerShell V2 is available by default with both R2 and Windows 7 and, via an optional update, previous versions of Windows.
For Developers specifically, Windows PowerShell in combination with the Windows Management Infrastructure (WinRM, WS-Management, WMI) provides a great way to automate server hosted solutions. For example, if you implement all your administration logic via
PowerShell, then layer the MMC GUI over the top (i.e. MMC calls PowerShell to get the work done) - you will have given your Enterprise customers the absolute best of all worlds; GUIs, scripting, and delegated, remote automation.
Unlike most scripting shells, which accept and return text, Windows PowerShell is integrated with the .NET Common Language Runtime (CLR) and the .NET Framework, and thus deals in .NET objects instead of just text strings. This fundamental change in the environment
brings entirely new tools and methods to the management and configuration of Windows. Application Developers may extend their solutions with custom PowerShell based object models that integrate seamlessly with platform management solutions.
Like many shells, Windows PowerShell gives you access to the file system on the computer. In addition, Windows PowerShell providers enable you to access other data stores, such as the registry and the digital signature certificate stores, as easily as you
access the file system.
Version 2 of Windows Powershell introduces an array of new features including remote sessions, an integrated script environment, debugging tools, and much more.
Continue your video tour of PowerShell V2 via
MSDN Channel9 and
TechNET Edge. Don't miss the reusable scripts and techniques at the
PowerShell Script-Center website. Subscribe to the PowerShell
Team Blog RSS Feed for the latest info.
See related episodes
here.
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
I don't like the choice of the relational operators. Everything in Powershell flows and looks natural, except these relational operators. Less than, equals, greater than, etc. Instead of using the natural and easy to remember and easy to type <, >, <=, >=, != and == symbols, which every programmer, from the beginner to the advanced, knows, you used the counter-intuitive -lt, -gt, -ge, -ne, etc, strings. I know, I know what you are going to say: "Other shell languages use similar things." But isn't this what Powershell wanted to change, namely the mess of the other shells. Instead of using inconsistent esac and fi and other end of block delimiters, Powershell simply uses the highly intuitive { and }. Very good! Instead of words which one has to memorize, Powershell uses punctuation like () and [] and , which is common to most imperative languages. Easy to learn and also easy to reuse in other programming tasks using other languages. Why then have you used these strange combinations for the relational operators? If it was for compatibility with the < and > operators in cmd.exe, it is not worth it since < does not work in Powershell anyway and > is problematic since many time one has to change the encoding anyway and so one has to type "| -encoding ascii filename". In any case, > piping simantecs is unnecessary, ambiguous and less flexible than the "|" to an "out-something" commandlet. Also, < and > piping does not fit into the simplistic model of Powershell which does not use extra operators when not needed. So, there is really no excuse?
I would also be interested in knowing why they chose -eq etc. instead of the standard operator set.
A "crapload of operators" that sounds like a lot.
I was in the v1 beta group back in MSH days. We fought over this for months. As both an (ex) ksh guy and a c-style programmer, I was on the side of using the normal operators like yourself. The real hangup was the ">" redirect operator (and to a lesser extent the ">>") as already taken. DOS and unix legacy scripters won, because the common use of that operator is well understood and they felt it would be too much of a change. It was really a SHELL -vs- language argument and a choice needed to be made. Not being able to use ">", also ment they could not really use the others ("<=", "==", etc) because the symmetry was now gone. Personally, I still think they made the wrong choice, but understand the other side. It would have been better to have the normal programmer operators and use something else for io and let the io folks deal with the change. Now with LINQ logic needing those operators and the fact that people want PSH integrated with things like VS and others , I am guessing some folks may be kicking themselfs.
Windows Power Shell its very good
-------------------
Free sms kostenlos
Remove this comment
Remove this thread
close