![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | -f operator Why and how does this work? PS I:\>Get-Date -f MMddyyHHmmss 052708131411 Normally the format pattern on the left side of -f, and the expression on the right: PS C:\> "{0:n}" -f 1234567 1 234 567,00 But on the example on the top it seems for me that it's the other way around. How does that work? -- Tibor |
My System Specs![]() |
| | #2 (permalink) |
| | Re: -f operator "Tibor Soos" <TiborSoos@xxxxxx> wrote in message news:7AF31D8D-5E86-4F33-851C-A24229FAC765@xxxxxx Quote: > Why and how does this work? > > PS I:\>Get-Date -f MMddyyHHmmss > 052708131411 > > Normally the format pattern on the left side of -f, and the expression on > the right: > PS C:\> "{0:n}" -f 1234567 > 1 234 567,00 > > But on the example on the top it seems for me that it's the other way > around. How does that work? arg MMddyyHHmmss. In PowerShell you only have to specify enough of the parameter name to disambiguate that parameter from any others on the cmdlet. So while the two invocations use -F the similarity is only superficial. One is a shortened parameter name while the other is a language operator. -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| | Re: -f operator Oh, that short form of parameters tricked me! Thanks a lot! -- Tibor "Keith Hill [MVP]" wrote: Quote: > "Tibor Soos" <TiborSoos@xxxxxx> wrote in message > news:7AF31D8D-5E86-4F33-851C-A24229FAC765@xxxxxx Quote: > > Why and how does this work? > > > > PS I:\>Get-Date -f MMddyyHHmmss > > 052708131411 > > > > Normally the format pattern on the left side of -f, and the expression on > > the right: > > PS C:\> "{0:n}" -f 1234567 > > 1 234 567,00 > > > > But on the example on the top it seems for me that it's the other way > > around. How does that work? > Get-Date has a -Format parameter that your first example is supplying the > arg MMddyyHHmmss. In PowerShell you only have to specify enough of the > parameter name to disambiguate that parameter from any others on the cmdlet. > So while the two invocations use -F the similarity is only superficial. One > is a shortened parameter name while the other is a language operator. > > -- > Keith > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: -f operator Keith, you need to be doing PowerShell seminars. ; ) "Keith Hill [MVP]" <r_keith_hill@xxxxxx_no_spam_I> wrote in message news:5446D1C0-115E-4CA4-BC28-FF04D4E14F49@xxxxxx Quote: > "Tibor Soos" <TiborSoos@xxxxxx> wrote in message > news:7AF31D8D-5E86-4F33-851C-A24229FAC765@xxxxxx Quote: >> Why and how does this work? >> >> PS I:\>Get-Date -f MMddyyHHmmss >> 052708131411 >> >> Normally the format pattern on the left side of -f, and the expression on >> the right: >> PS C:\> "{0:n}" -f 1234567 >> 1 234 567,00 >> >> But on the example on the top it seems for me that it's the other way >> around. How does that work? > Get-Date has a -Format parameter that your first example is supplying the > arg MMddyyHHmmss. In PowerShell you only have to specify enough of the > parameter name to disambiguate that parameter from any others on the > cmdlet. So while the two invocations use -F the similarity is only > superficial. One is a shortened parameter name while the other is a > language operator. > > -- > Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| -ne operator | PowerShell | |||
| 64 bit binary or (-bor operator)? | PowerShell | |||
| What does the $() operator do? | PowerShell | |||
| Suggestion: 1 new operator (well, maybe 6...) | PowerShell | |||
| -f Format Operator | PowerShell | |||