Get-ChildItem cmdlet can be used to get the items or child items in one or more specific locations.
In these examples, we're see the Get-ChildItem cmdlet in action.
In this example, first we've a file test.txt in D:\temp\test with content "Welcome to TutorialsPoint.Com" and test1.txt with content "Hello World!" and "Welcome to TutorialsPoint.Com" in two lines.
Get the file details in a variable.
$A = Get-ChildItem D:\temp\test\*.txt
Get the file details using Format-Wide cmdlet.
Format-Wide -InputObject $A
You can see following output in PowerShell console.
Directory: D:\temp\test test.txt test1.txt
Get the names of the items in current directory.
Type the following command in PowerShell ISE Console
You can see following output in PowerShell console consider being in D:\temp\Test directory.
test.csv test.txt test.xml test1.txt