powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Start-Process



NAME
Start-Process

SYNOPSIS
Starts one or more processes on the local computer.

SYNTAX
Start-Process [-FilePath] [[-ArgumentList] ] [-Credential ] [-LoadUserProfile] [-N
oNewWindow] [-PassThru] [-RedirectStandardError ] [-RedirectStandardInput ] [-RedirectStandardOutpu
t ] [-UseNewEnvironment] [-Wait] [-WorkingDirectory ] []

Start-Process [-FilePath] [[-ArgumentList] ] [-PassThru] [-Verb ] [-Wait] [-WindowStyle
{Normal | Hidden | Minimized | Maximized}] [-WorkingDirectory ] []


DESCRIPTION
Starts one or more processes on the local computer. To specify the program that runs in the process, enter an exec
utable file or script file, or a file that can be opened by using a program on the computer. If you specify a non-e
xecutable file, Start-Process starts the program that is associated with the file, much like the Invoke-Item cmdlet
.

You can use the parameters of Start-Process to specify options, such as loading a user profile, starting the proces
s in a new window, or using alternate credentials.


PARAMETERS
-ArgumentList
Specifies parameters or parameter values to use when starting the process. The parameter name ("Arguments") is
optional.

Required? false
Position? 2
Default value None
Accept pipeline input? false
Accept wildcard characters? false

-Credential
Specifies a user account that has permission to perform this action. Type a user-name, such as "User01" or "Dom
ain01\User01", or enter a PSCredential object, such as one from the Get-Credential cmdlet. By default, the cmdl
et uses the credentials of the current user.

Required? false
Position? named
Default value Current user.
Accept pipeline input? false
Accept wildcard characters? false

-FilePath
Specifies the path (optional) and file name of the program that runs in the process. Enter the name of an execu
table file or of a document, such as a .txt or .doc file, that is associated with a program on the computer. Th
is parameter is required.

If you specify only a file name, use the WorkingDirectory parameter to specify the path.

Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false

-LoadUserProfile []
Loads the Windows user profile stored in the HKEY_USERS registry key for the current user. The default value is
FALSE.

This parameter does not affect the Windows PowerShell profiles. (See about_Profiles.)

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-NoNewWindow []
Prevents the process from running in a new window. By default, the process runs in a new window.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-PassThru []
Returns a process object for each process that the cmdlet started. By default, this cmdlet does not generate an
y output.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-RedirectStandardError
Sends any errors generated by the process to a file that you specify. Enter the path and file name. By default,
the errors are displayed in the console.

Required? false
Position? named
Default value Errors are displayed in the console
Accept pipeline input? false
Accept wildcard characters? false

-RedirectStandardInput
Reads input from the specified file. Enter the path and file name of the input file. By default, the process ge
ts its input from the keyboard.

Required? false
Position? named
Default value Keyboard
Accept pipeline input? false
Accept wildcard characters? false

-RedirectStandardOutput
Sends the output generated by the process to a file that you specify. Enter the path and file name. By default,
the output is displayed in the console.

Required? false
Position? named
Default value FALSE
Accept pipeline input? false
Accept wildcard characters? false

-UseNewEnvironment []
Use new environment variables specified for the process. By default, the started process runs with the environm
ent variables specified for the computer and user.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-Verb
Specifies a verb to be used when starting the process, such as Edit, Open, or Print.

Each file type has a set of verbs that you can use. To find the verbs that can be used with the process, use th
e Verbs property of the object.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Wait []
Waits for the specified process to complete before accepting more input. This parameter suppresses the command
prompt or retains the window until the process completes.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-WindowStyle
Specifies the state of the windows used for the process. Valid values are Normal, Hidden, Minimized, and Maximi
zed. The default value is Normal.

Required? false
Position? named
Default value Normal
Accept pipeline input? false
Accept wildcard characters? false

-WorkingDirectory
Specifies the location of the executable file or document that runs in the process. The default is the current
directory.

Required? false
Position? named
Default value Current directory
Accept pipeline input? false
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS
None
You cannot pipe input to Start-Process.


OUTPUTS
None or System.Diagnostics.Process
When you use the PassThru parameter, Start-Process generates a System.Diagnostics.Process. Otherwise, this cmdl
et does not return any output.


NOTES


This cmdlet is implemented by using the Start method of the System.Diagnostics,Process class. For more informat
ion about this method, see "Process.Start Method" in the MSDN (Microsoft Developer Network) library at http://g
o.microsoft.com/fwlink/?LinkId=143602.


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

C:\PS>start-process sort.exe


Description
-----------
This command starts a process that uses the Sort.exe file in the current directory. The command uses all of the def
ault values, including the default window style, working directory, and credentials.





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

C:\PS>start-process myfile.txt -workingdirectory "C:\PS-Test" -verb Print


Description
-----------
This command starts a process that prints the C:\PS-Test\MyFile.txt file.





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

C:\PS>start-process Sort.exe -RedirectStandardInput Testsort.txt -RedirectStandardOutput Sorted.txt -RedirectStanda
rdError SortError.txt -UseNewEnvironment


Description
-----------
This command starts a process that sorts items in the Testsort.txt file and returns the sorted items in the Sorted.
txt files. Any errors are written to the SortError.txt file.

The UseNewEnvironment parameter specifies that the process runs with its own environment variables.





-------------------------- EXAMPLE 4 --------------------------

C:\PS>start-process notepad -wait -windowstyle Maximized


Description
-----------
This command starts the Notepad process. It maximizes the window and retains the window until the process completes
.






RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=135261
Start-Service
Get-Process
Stop-Process
Wait-Process
Debug-Process