PowerShell Logo Small

Get-Item



This is the built-in help made by Microsoft for the command 'Get-Item', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the item at the specified location.

SYNTAX


Get-Item [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-UseTran
saction] [<CommonParameters>]
Get-Item [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-UseTransaction
] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Item cmdlet gets the item at the specified location. It does not get the contents of the item at the location unless you use a wildcard c
haracter (*) to request all the contents of the item.

The Get-Item cmdlet is used by Windows PowerShell providers to enable you to navigate through different types of data stores.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113319
about_Providers
Clear-Item
Copy-Item
Invoke-Item
Move-Item
Set-Item
New-Item
Remove-Item
Rename-Item

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>get-item .

Directory: C:\

Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 10:01 AM ps-test



Description
-----------
This command gets the current directory. The dot (.) represents the item at the current location (not its contents).








-------------------------- EXAMPLE 2 --------------------------

C:\PS>get-item *

Directory: C:\ps-test

Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 9:29 AM Logs
d---- 7/26/2006 9:26 AM Recs
-a--- 7/26/2006 9:28 AM 80 date.csv
-a--- 7/26/2006 10:01 AM 30 filenoext
-a--- 7/26/2006 9:30 AM 11472 process.doc
-a--- 7/14/2006 10:47 AM 30 test.txt



Description
-----------
This command gets all the items in the current directory. The wildcard character (*) represents all the contents of the current item.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>get-item C:\



Description
-----------
This command gets the current directory of the C: drive. The object that is retrieved represents only the directory, not its contents.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>get-item C:\*



Description
-----------
This command gets the items in the C: drive. The wildcard character (*) represents all the items in the container, not just the container.

In Windows PowerShell, use a single asterisk (*) to get contents, instead of the traditional "*.*". The format is interpreted literally, so "*.*"
would not retrieve directories or file names without a dot.








-------------------------- EXAMPLE 5 --------------------------

C:\PS>(get-item C:\Windows).LastAccessTime



Description
-----------
This command gets the LastAccessTime property of the C:\Windows directory. LastAccessTime is just one property of file system directories. To see
all of the properties of a directory, type "(Get-Item <directory-name>) | Get-Member".








-------------------------- EXAMPLE 6 --------------------------

C:\PS>get-item hklm:\software\microsoft\powershell\1\shellids\microsoft.powershell\*



Description
-----------
This command shows the contents of the Microsoft.PowerShell registry key. You can use Get-Item with the Windows PowerShell Registry provider to g
et registry keys and subkeys, but you must use Get-ItemProperty to get the registry values and data.








-------------------------- EXAMPLE 7 --------------------------

C:\PS>get-item c:\Windows\* -include *.* -exclude w*



Description
-----------
This command gets items in the Windows directory with names that include a dot (.), but do not begin with w*. This command works only when the pa
th includes a wildcard character (*) to specify the contents of the item.