none
Powershell Beginner Question: Quick way to get value of an object property? RRS feed

  • Question

  • Hello.

    I am new to Windows Powershell and am trying to learn it.

    I am trying to understand how to quick get the values of object properties. For example, I am working in a directory with multiple text files. I can run the following to view the "IsReadOnly" property of one of the text files:

    Get-ChildItem .\test1.txt | ForEach-Object {$_.IsReadOnly}

    This works fine, but I would think that I could simply type the following and have Powershell return the value within:

    test1.txt.IsReadOnly

    This format of Object.Property doesn't seem to work. Am I missing something or is my only option to first select the object using "Get-ChildItem" and then pipe the object?

    Thanks for your help! I'm looking forward to learning more of this stuff.

    Sunday, February 23, 2014 4:58 AM

Answers

All replies