< Back
Invoke-Batch
Post
NAME Invoke-Batch
SYNOPSIS
Utility function for executing batch jobs using Invoke-Command
SYNTAX
Invoke-Batch [-BatchFile] <String> [[-Arguments] <String[]>] [[-WorkingDirectory] <String>] [[-RunAsCredential]
<PSCredential>] [-UseNewSession] [<CommonParameters>]
DESCRIPTION
Utility function for executing batch jobs using Invoke-Command
PARAMETERS
-BatchFile <String>
The path to the batch file that will be executed.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Arguments <String[]>
The arguments that will be passed to the process if applicable.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WorkingDirectory <String>
The directory from which to invoke the process. It may be useful for batch files with relative paths.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RunAsCredential <PSCredential>
If specified, it will be passed to the Invoke-Command cmdlet
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-UseNewSession [<SwitchParameter>]
If specified, the batch job will be invoked in a new PSSession
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Invokes a hello world batch file that echos the first argument
Invoke-Batch "C:\\TEMP\\hello.bat" @("Hello World")
RELATED LINKS
SYNOPSIS
Utility function for executing batch jobs using Invoke-Command
SYNTAX
Invoke-Batch [-BatchFile] <String> [[-Arguments] <String[]>] [[-WorkingDirectory] <String>] [[-RunAsCredential]
<PSCredential>] [-UseNewSession] [<CommonParameters>]
DESCRIPTION
Utility function for executing batch jobs using Invoke-Command
PARAMETERS
-BatchFile <String>
The path to the batch file that will be executed.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Arguments <String[]>
The arguments that will be passed to the process if applicable.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-WorkingDirectory <String>
The directory from which to invoke the process. It may be useful for batch files with relative paths.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RunAsCredential <PSCredential>
If specified, it will be passed to the Invoke-Command cmdlet
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-UseNewSession [<SwitchParameter>]
If specified, the batch job will be invoked in a new PSSession
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Invokes a hello world batch file that echos the first argument
Invoke-Batch "C:\\TEMP\\hello.bat" @("Hello World")
RELATED LINKS