Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

exploring $profile makes me ask a question about Format-List

$
0
0

Look at this sequence of commands below and the results using powershell.exe v3.
Why does adding the -force parameter to that last command make it display the NoteProperties ?
And, why is the value of the Length property 75 ?  

<#c:#> $profile
C:\Users\Larry\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1<#c:#> $profile.gettype()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     String                                   System.Object


<#c:#> $profile | gm -membertype *prop*


   TypeName: System.String

Name                   MemberType            Definition
----                   ----------            ----------
AllUsersAllHosts       NoteProperty          System.String AllUsersAllHosts=C:\Windows\System32\WindowsPow...
AllUsersCurrentHost    NoteProperty          System.String AllUsersCurrentHost=C:\Windows\System32\Windows...
CurrentUserAllHosts    NoteProperty          System.String CurrentUserAllHosts=C:\Users\Larry\Documents\Wi...
CurrentUserCurrentHost NoteProperty          System.String CurrentUserCurrentHost=C:\Users\Larry\Documents...
Chars                  ParameterizedProperty char Chars(int index) {get;}
Length                 Property              int Length {get;}

<#c:#> $profile | Format-List *
C:\Users\Larry\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1<#c:#> $profile | Format-List * -force


AllUsersAllHosts       : C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost    : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts    : C:\Users\Larry\Documents\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\Larry\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Length                 : 75



<#c:#>


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>