![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #2 (permalink) | ||||||||||||
| Guest | Re: count Try it myself : $mycount = $directory | measure-object -property length -sum $mycount.count ==> at least it gives a number count. Let me know if u guys have other solutions. "IT STAFF" <jkklim@xxxxxx> wrote in message news:uB24cbk5IHA.3420@xxxxxx
| ||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | Re: count On Jul 14, 11:48*pm, "IT STAFF" <jkk...@xxxxxx> wrote:
if ($directory){do something} | ||||||||||||
| | #4 (permalink) |
| Guest | Re: count Force the result to array so it will always have a count property even when there is only one item: @(dir $directory).count --- Shay Levy Windows PowerShell MVP blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic IS> PS D:\> $directory IS> \\NOL-A0049001\D$\089228b5520c384a86 IS> $directory | gm ==> returns system string. IS> IS> In the above, there is a record. IS> IS> If i do a $directory.count, it gives $null and not ONE IS> IS> How do i ensure there is a scalar value in the $directory.count ? IS> |
| | #5 (permalink) | ||||||||||||||||||||||||
| Guest | Re: count I always use If ($Object) {..} That is equivalent of "If Exist $Object". You can use same for If ($Object.Count) {...}, which can be translated as "If not $Object.Count is Nothing"... Martin "IT STAFF" <jkklim@xxxxxx> wrote in message news:uLuduxk5IHA.3480@xxxxxx
| ||||||||||||||||||||||||
| | #6 (permalink) | ||||||||||||
| Guest | Re: count Tested not working. "Shay Levy [MVP]" <no@xxxxxx> wrote in message news:89228ed23682d8cab4825a8667bc@xxxxxx
| ||||||||||||
| | #7 (permalink) |
| Guest | Re: count PoSh [11] » $directory = "\\NOL-A0049001\D$\089228b5520c384a86" PoSh [12] » @(dir $directory).count Get-ChildItem : Cannot find path '\\NOL-A0049001\D$ \089228b5520c384a86' because it does not exist. At line:1 char:6 + @(dir <<<< $directory).count 0 Throws an error because the path doesn't exist, but still shows the count 0. PoSh [13] » $directory = "C:\windows\desktop.ini" PoSh [14] » @(dir $directory).count 1 Found one file and shows count. Hope that helps. |
| | #8 (permalink) |
| Guest | Re: count Is it hidden? If so add -force to dir. --- Shay Levy Windows PowerShell MVP blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic K> PoSh [11] » $directory = "\\NOL-A0049001\D$\089228b5520c384a86" K> PoSh [12] » @(dir $directory).count K> Get-ChildItem : Cannot find path '\\NOL-A0049001\D$ K> \089228b5520c384a86' because it does not exist. K> At line:1 char:6 K> + @(dir <<<< $directory).count K> 0 K> Throws an error because the path doesn't exist, but still shows the K> count 0. K> K> PoSh [13] » $directory = "C:\windows\desktop.ini" K> PoSh [14] » @(dir $directory).count K> 1 K> Found one file and shows count. K> K> Hope that helps. K> |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pop ups blocker count | Karen | Vista security | 1 | 12-31-2007 11:22 AM |
| KMS Server n count | mustangcobra44 | Vista General | 1 | 06-08-2007 05:36 AM |
| Message count | Gerry Cornell | Vista mail | 3 | 04-04-2007 06:26 AM |
| Count | Thomas | PowerShell | 3 | 03-02-2007 01:23 AM |