Author Posts

March 15, 2018 at 8:03 pm

What's the difference between these two commands?

If I do

Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Office"

it shows the items, but if I do

Get-Content -Path "C:\Program Files (x86)\Microsoft Office"

it says "Get-Content : Access to the path 'C:\Program Files (x86)\Microsoft Office' is denied."

March 15, 2018 at 8:05 pm

Get-ChildItem retrieves directory listings.

Get-Content reads text files.

"C:\Program Files (x86)\Microsoft Office" isn't a file. It's a folder. Folders don't have 'contents.' They have _child items_, like files and other folders.

March 15, 2018 at 8:09 pm

Thank you, makes sense now