惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
博客园 - 司徒正美
Vercel News
Vercel News
I
InfoQ
GbyAI
GbyAI
C
Check Point Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
B
Blog
MyScale Blog
MyScale Blog
腾讯CDC
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)

博客园 - Vincent Yang

Cannot load macro project error SQL Express - "Failed generate a user instance..." SQL Express 2008 x64 Integration with Visual Studio 2008 SP1 Crystal Reports .NET Error - "Access to report file denied. Another program may be using it." - Vincent Yang (转:)SharePoint Database Naming Standards List Types & List Internal ID available within MOSS 2007 Telerik: IIS7 & IIS 7.5 and ‘Telerik.Web.UI.WebResource.axd’ is missing in web config 64bit SQL Server issues : Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly 正式入住Windows 7 + XPM A Generic Singleton Form Provider for C# Extreme Programming: Do these 12 practices make perfect? Pick up the pace with extreme programming Testing an ASP.NET Web Service using PowerShell Parsing XML Files with PowerShell Testing SQL Stored Procedures using PowerShell Working with Collections of Objects using PowerShell Generating iCalender file using ASP.NET SQL Server Precision And Scale Problems (SQL Server 精度问题) Six Quick Crystal Reports Design Tips
PowerShell Operators
Vincent Yang · 2010-02-06 · via 博客园 - Vincent Yang

PowerShell's Operators

Operator

Definition

## The hash key is for comments
+Add
-Subtract
*Multiply 
/Divide
%Modulus (Some call it Modulo) - Means remainder 17 % 5 = 2 Remainder
=equal
-notlogical not equal
!logical not equal
-bandbinary and
-borbinary or 
-bnotbinary not
-replaceReplace (e.g.  "abcde" –replace "b","B") (case insensitive)
-ireplaceCase-insensitive replace (e.g.  "abcde" –ireplace "B","3")
-creplaceCase-sensitive replace (e.g.  "abcde" –creplace "B","3")
-andAND (e.g. ($a -ge 5 -AND $a -le 15) )
-orOR  (e.g. ($a –eq "A" –OR $a –eq "B") )
-isIS type (e.g. $a -is [int] )
-isnotIS not type (e.g. $a -isnot [int] )
-asconvert to type (e.g. 1 -as [string] treats 1 as a string )
..Range operator (e.g.  foreach ($i in 1..10) {$i }  )
&call operator (e.g. $a = "Get-ChildItem" &$a executes Get-ChildItem)
. (dot followed by a space)call operator (e.g. $a = "Get-ChildItem" . $a executes Get-ChildItem in the current scope)
..Period or .full stop for an objects properties
$CompSys.TotalPhysicalMemory
-FFormat operator (e.g. foreach ($p in Get-Process) { "{0,-15} has {1,6} handles" –F  $p.processname,$p.Handlecount } )

PowerShell's Conditional or Comparison Operators

Operator

Definition

-ltLess than
-leLess than or equal to
-gtGreater than
-geGreater than or equal to
-eqEqual to
-neNot Equal to
-containsDetermine elements in a group. 
This always returns Boolean $True or $False.
-notcontainsDetermine excluded elements in a group
This always returns Boolean $True or $False.
-likeLike - uses wildcards for pattern matching
-notlikeNot Like - uses wildcards for pattern matching
-matchMatch - uses regular expressions for pattern matching
-notmatchNot Match - uses regular expressions for pattern matching
 Bitwise
-bandBitwise AND
-borBitwise OR
-isIs of Type
-isnotIs not of Type
 Other Operators
if(condition)If condition
elseIf(condition)ElseIF
else(condition)Else
>Redirect, for example, output to text file
Example   .\cmdlet > stuff.txt
>>Same as Redirect except it appends to an existing file