Shell_ExecuteWithTimeout
Shell_ExecuteWithTimeout
SYNOPSIS
Executes a command line application with a timeout.
SYNTAX
__AllParameterSets
Shell_ExecuteWithTimeout [-Command] <string> [[-Arguments] <string>] [[-MustExist] <bool>]
[[-Timeout] <int>] [<CommonParameters>]
ALIASES
This cmdlet has the following aliases,
DESCRIPTION
This function executes a command line application with the specified arguments and options. It will wait for the specified timeout before returning.
EXAMPLES
EXAMPLE 1
Shell_ExecuteWithTimeout -Command “msiexec” -Arguments “/i C:\Temp\MyInstaller.msi” -Timeout 60
PARAMETERS
-Arguments
The arguments to pass to the command.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
ParameterValue: []
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Command
The command to execute.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
ParameterValue: []
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MustExist
Indicates if the command must exist, default is $false. If set to $true you need to specify the full path to the command.
Type: System.Boolean
DefaultValue: False
SupportsWildcards: false
ParameterValue: []
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Timeout
The timeout in seconds.
Type: System.Int32
DefaultValue: 30
SupportsWildcards: false
ParameterValue: []
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.