Open In App

How to find the file properties using powershell

Last Updated : 21 Nov, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

PowerShell is a modern command shell that includes the best features of different shells . Unlike the other shells which only accept and return the text but in PowerShell it is different it returns the object in the .NET objects. In this article we will find out certain commands to  find the file properties using PowerShell.

Find the file properties

Now to access the file properties using the PowerShell we use some commands in order to get the file properties,

  • Get-Item <Path of Folder>
  • Get-ItemProperty <Path of Folder>
  • Get-ChildItem <Path of Folder>

Using Get-ChildItem to find the file properties

Get-ChildItem is used to gets the items and child items in one or more specified locations.

PS C:\Users\DELL> Get-ChildItem -Path C:\Users\DELL\Pictures
 find the file properties using powershell
 find the file properties using PowerShell

 Using Get-Item to find the file properties

Get-Item command is used to gets the items at the specified location.

PS C:\Users\DELL>  Get-Item -Path C:\Users\DELL\Downloads
 find the file properties using powershell
 find the file properties using PowerShell

Using Get-ItemProperty to find the file properties

Get-ItemProperty command is used to gets the properties of all the items at the specified path.

PS C:\Users\DELL> Get-ItemProperty -Path C:\Users\DELL\Downloads | Get-Member -MemberType property
 find the file properties using powershell
 find the file properties using PowerShell

Access the particular file properties

PS C:\Users\HP> $file = get-childItem C:\Users\HP\OneDrive\Desktop\pro1.txt
PS C:\Users\HP> $file.name
pro1.txt
PS C:\Users\HP> $file.extension
.txt
PS C:\Users\HP> $file.length
389
PS C:\Users\HP> $file.basename
pro1
 find the file properties using powershell
 find the file properties using PowerShell

Next Article

Similar Reads