PowerShell Logo Small

Get-Item



This is the built-in help made by Microsoft for the command 'Get-Item', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' 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 files and folders.

SYNTAX


Get-Item [-Path] <String[]> [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>]
[-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Get-Item [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>] -LiteralPath <String[]>
[-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Get-Item [-Stream <string>] [<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 character (*) 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.

In the file system, the Get-Item cmdlet gets files and folders.

Note: This custom cmdlet help file explains how the Get-Item cmdlet works in a file system drive. For information about the Get-Item cmdlet in
all drives, type "Get-Help Get-Item -Path $null" or see Get-Item at http://go.microsoft.com/fwlink/?LinkID=113319.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=271998
Get-Item
(generic); http://go.microsoft.com/fwlink/?LinkID=113319
FileSystem Provider
Add-Content
Clear-Content
Get-Content
Get-ChildItem
Get-Content
Get-Item
Remove-Item
Set-Content
Test-Path

REMARKS

<

Examples


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

C:\PS>Get-Item C:\Users\User01\Downloads\InternetFile.docx -Stream *

FileName: C:\Users\User01\Downloads\InternetFile.docx

Stream Length
------ ------
:$DATA 45056
Zone.Identifier 26



Description

-----------

This command gets all stream data from a file that was downloaded from the Internet. The Zone.Identifier stream identifies a file that
originated on the Internet. The $DATA stream is the default.

The Stream parameter is introduced in Windows PowerShell 3.0.








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

C:\PS>Get-Item C:\ps-test\* -Stream Zone.Identifier -ErrorAction SilentlyContinue


FileName: C:\ps-test\Copy-Script.ps1

Stream Length
------ ------
Zone.Identifier 26


FileName: C:\ps-test\Start-ActivityTracker.ps1

Stream Length
------ ------
Zone.Identifier 26



Description

-----------

This command gets Zone.Identifier stream data from all files in the C:\ps-test directory. The command uses the Stream parameter to specify the
alternate stream and he ErrorAction parameter with a value of SilentlyContinue to suppress non-terminating errors that are generated when a
file has no alternate data streams.

The Stream parameter is introduced in Windows PowerShell 3.0.








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

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 4 --------------------------

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 the current directory of the C: drive. The object that is retrieved represents only the directory, not its contents.








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

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 6 --------------------------

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 7 --------------------------

C:\PS>Get-Item C:\Windows\*.* -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
path includes a wildcard character (*) to specify the contents of the item.