Invoke-Item
Additional Resources for Invoke-Item |
Opening a File or Running a Program http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/invoke-item.mspx
|
SYNOPSIS
Invokes the provider-specific default action on the specified item.
SYNTAX
Invoke-Item [-path] <string[]> [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-credential <PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]
Invoke-Item [-literalPath] <string[]> [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-credential <PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]
DETAILED DESCRIPTION
Invokes the provider-specific default action on the specified item. When applied to a file system item, for example, it will either run the file or open it with the application associated with that file type.
PARAMETERS
-path <string[]>
The path to the item or file that is the object of the Cmdlet.
Required? |
true |
Position? |
1 |
Default value |
N/A - The path must be specified |
Accept pipeline input? |
true (ByValue, ByPropertyName) |
Accept wildcard characters? |
true |
-include <string[]>
Specifies only those items upon which the Cmdlet will act, excluding all others.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
true |
-exclude <string[]>
Omits the specified items. Wildcards are permitted.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
true |
-filter <string>
Specifies filter elements as required and supported by providers.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-credential <PSCredential>
The credential is used to validate access. If a PSCredential object obtained earlier using get-credential is supplied, it will be used as is. If a user name is supplied, there will be a prompt for a password.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByPropertyName) |
Accept wildcard characters? |
false |
-literalPath <string[]>
Specifies a path to the item. 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 |
-whatIf
Describes what would happen if you executed the command without actually executing the command.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-confirm
Prompts you for confirmation before executing the command.
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, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
String
EXAMPLE 1
invoke-item C:\Test\aliasApr04.doc
This command opens the file aliasApr04.doc in Microsoft Word.
EXAMPLE 2
invoke-item "C:\Documents and Settings\Lister\My Documents\*.xls"
This command opens all of the Microsoft Excel spreadsheets in the C:\Documents and Settings\Lister\My Documents folder. Each spreadsheet is opened in a new instance of Excel.
RELATED LINKS