![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Powershell Operators I was stumbling on the internet about powershell script when I found this one get-childitem -recurse | where-object { $_.CreationTime -ilt [datetime]::now.adddays(-120) } | move-item -destination 'C:\Documents and Settings\administrator\My Documents\My Scripts\Location2' source: http://www.eggheadcafe.com/software/...intain-fo.aspx I tried it and love it, I know was it does, but I'm confused by $_.CreationTime -ilt [datetime]::now.adddays(-120) This is the first time I see something like this Can you please explain this please ? -itl : first time I see this operator [datetime]::now.adddays(-120) : first time I see this kind of construction (I would love to know more about this kind of trick) I tried to find some info on -itl, and I found this http://d.hatena.ne.jp/newpops/20070111/p1 This seems to be all the powershell operators, but some of them are definitely unknown "eq","ne","ge","gt","lt","le","like","notlike","match", "notmatch","ieq","ine","ige","igt","ile","ilt","ilike", "inotlike","imatch","inotmatch","ceq","cne","cge","cgt", "clt","cle","clike","cnotlike","cmatch","cnotmatch" Is there a documentation somewhere about these operators ? all of them ? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Powershell Operators In this case the i is not applicable. i = ignore case c= case sensative Because numbers do not have case. I would assume that -ilt is exactly the same as -lt and -clt Excerpt from about_operator OPERATORS The comparison operators for the shell, by default, the comparison operators are not case sensitive when comparing strings. Case sensitive variants exist for comparison operators as well as explicit case insensitive operators. -eq Equal (case insensitive) -ne Not equal (case insensitive) -ge Greater than or equal (case insensitive) -gt Greater than (case insensitive) -lt Less than (case insensitive) -le Less than or equal (case insensitive) -like Wildcard comparison (case insensitive) -notlike Wildcard comparison (case insensitive) -match Regular expression comparison (case insensitive) -notmatch Regular expression comparison (case insensitive) -replace Replace operator (case insensitive) -contains Containment operator (case insensitive) -notcontains Containment operator (case insensitive) -ieq Case insensitive equal -ine Case insensitive not equal -ige Case insensitive greater than or equal -igt Case insensitive greater than -ile Case insensitive less than or equal -ilt Case insensitive less than -ilike Case insensitive equal -inotlike Case insensitive equal -imatch Case insensitive regular expression comparison -inotmatch Case insensitive regular expression comparison -ireplace Case insensitive replace operator -icontains Case insensitive containment operator -inotcontains Case insensitive containment operator -ceq Equal (case sensitive) -cne Not equal (case sensitive) -cge Greater than or equal (case sensitive) -cgt Greater than (case sensitive) -clt Less than (case sensitive) -cle Less than or equal (case sensitive) -clike Wildcard comparison (case sensitive) -cnotlike Wildcard comparison (case sensitive) -cmatch Regular expression comparison (case sensitive) -cnotmatch Regular expression comparison (case sensitive) -creplace Replace operator (case sensitive) -ccontains Containment operator (case sensitive) -cnotcontains Containment operator (case sensitive) -is Is of a type -isnot Is not of a type -as As a type, no error if conversion fails Brandon Shell --------------- Blog: http://www.bsonposh.com/ PSH Scripts Project: www.codeplex.com/psobject P> I was stumbling on the internet about powershell script when I found P> this one P> P> get-childitem -recurse | where-object { $_.CreationTime -ilt P> [datetime]::now.adddays(-120) } | move-item -destination P> 'C:\Documents P> and P> Settings\administrator\My Documents\My Scripts\Location2' P> source: P> http://www.eggheadcafe.com/software/...eitem-and-main P> tain-fo.aspx P> P> I tried it and love it, I know was it does, but I'm confused by P> $_.CreationTime -ilt [datetime]::now.adddays(-120) P> P> This is the first time I see something like this P> P> Can you please explain this please ? P> P> -itl : first time I see this operator P> P> [datetime]::now.adddays(-120) : first time I see this kind of P> construction (I would love to know more about this kind of trick) P> P> I tried to find some info on -itl, and I found this P> http://d.hatena.ne.jp/newpops/20070111/p1 P> P> This seems to be all the powershell operators, but some of them are P> definitely unknown P> P> "eq","ne","ge","gt","lt","le","like","notlike","match", P> "notmatch","ieq","ine","ige","igt","ile","ilt","ilike", P> "inotlike","imatch","inotmatch","ceq","cne","cge","cgt", P> "clt","cle","clike","cnotlike","cmatch","cnotmatch" P> P> Is there a documentation somewhere about these operators ? all of P> them ? P> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Powershell Operators On Nov 19, 10:26*pm, Personne <cpdiv...@xxxxxx> wrote: Quote: > [datetime]::now.adddays(-120) : first time I see this kind of > construction (I would love to know more about this kind of trick) Now is a static property of the system.datetime datatype and the double colon is simply the syntax for calling a static method or property. You can find the static methods and properties of datetime with: [datetime] | get-member -static |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| redirection operators as syntactic suger | PowerShell | |||
| CTP2 comparison operators | PowerShell | |||
| Subexpressions and Unary Operators | PowerShell | |||
| PowerShell User Guide - Comparison Operators - error? | PowerShell | |||
| Bit Operators | PowerShell | |||