Get-Item - PowerShell command help and examples

Gets the item at the specified location. (Get-Item)


NAME
Get-Item
SYNOPSIS
Gets the item at the specified location.
SYNTAX
Get-Item [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-UseTransaction] [<CommonParameters>] Get-Item [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-UseTransaction] [<CommonParameters>]
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.
PARAMETERS
-Credential <PSCredential> Specifies a user account that has permission to perform this action. The default is the current user. Type a user-name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password. This parameter is not supported by any providers installed with Windows PowerShell. Required? false Position? named Default value Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false -Exclude <string[]> Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted. The Exclude parameter is effective only when the command includes the contents of an item, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Filter <string> Specifies a filter in the provider's format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Force [<SwitchParameter>] Allows the cmdlet to get items that cannot otherwise be accessed, such as hidden items. Implementation varies from provider to provider. For more information, see about_Providers. Even using the Force parameter, the cmdlet cannot override security restrictions. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Include <string[]> Retrieves only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted. The Include parameter is effective only when the command includes the contents of an item, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -LiteralPath <string[]> Specifies a path to the item. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. Required? true Position? 1 Default value Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false -Path <string[]> Specifies the path to an item. Get-Item gets the item at the specified location. Wildcards are permitted. This parameter is required, but the parameter name ("Path") is optional. Use a dot (.) to specify the current location. Use the wildcard character (*) to specify all the items in the current location. Required? true Position? 1 Default value Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? false -UseTransaction [<SwitchParameter>] Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_Transactions. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
INPUTS
System.String You can pipe a string that contains a path to Get-Item.
OUTPUTS
Object Get-Item returns the objects that it gets. The type is determined by the type of objects in the path.
NOTES
You can also refer to Get-Item by its built-in alias, "gi". For more information, see about_Aliases. Get-Item does not have a Recurse parameter, because it gets only an item, not its contents. To get the contents of an item recursively, use Get-ChildItem. To navigate through the registry, use Get-Item to get registry keys and Get-ItemProperty to get registry values and data. The registry values are considered to be properties of the registry key. The Get-Item cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type "Get-PsProvider". For more information, see about_Providers.

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

Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.

ColorConsole [Version 3.7.1000] PowerShell 2.0-Export

Windows 11, 10, 8.1, 8, 7 / Server 2022, 2019, 2016











Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



PowerShell: Gets the item at the specified location.

HTTP: ... PS_Windows/en/Get-Item.htm
0.062
12064
Wird der reservierte Speicher in Windows bei jedem Update benötigt?
Files that are younger than the date can be deleted via the command line!
How do I create a text file?
Extend the output memory of the CMD prompt!
Can I scans all protected system files (command-line)?
Can I open Registry Editor on Windows?
Can I share the smart drive ejection tool for Windows to all User for free?
Aktivieren / Deaktivieren des Vorschaufensters des Windows Explorer?
Was sind Windows Netzwerkadapter?
Weitere Schriftarten für die Windows 11, 10, ... Eingabeaufforderung freigeben!



(0)