Situatie
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.
Solutie
Pasi de urmat
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
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
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
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
Leave A Comment?