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

推荐订阅源

IT之家
IT之家
博客园_首页
S
SegmentFault 最新的问题
罗磊的独立博客
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
D
Docker
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
V
V2EX
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
腾讯CDC
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Help Net Security
博客园 - Franky
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏

博客园 - 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