Want to start, stop, or kill a process using Command Prompt or PowerShell? This tutorial shows you how and explains the commands.
While most Windows users rarely need to manage processes manually, there will be situations where it is necessary. For instance, you might need to force-stop a frozen process or kill one that’s consuming too many system resources. Alternatively, you might have specific programs you only need to launch occasionally via command line. Whatever your specific use case is, you can easily start, stop, or kill any process in Windows using the Command Prompt and PowerShell.
These methods are particularly helpful when creating custom scripts, when the task manager is unresponsive, and to create desktop shortcuts.
This guide will walk you through how to start a process and stop a process (kill process) using Command Prompt and PowerShell in Windows 11 and Windows 10.
Before You Start
Some processes, such as system-level services, system processes, and processes belonging to other users require admin rights to start and stop.
Starting and Stopping Processes Using Command Prompt
Starting a Process
- Open the Start menu by clicking the “Windows” icon on the taskbar.
- Search for “Command Prompt” and click “Open“.
- Run the
start "C:\path\to\process.exe"
while replacing the dummy path between quotes with the actual path to the process.- Programs in the system PATH, like “explorer.exe” or “notepad.exe”, don’t require a full path. For example, to start Windows Explorer, you can type
start explorer.exe
.
- Programs in the system PATH, like “explorer.exe” or “notepad.exe”, don’t require a full path. For example, to start Windows Explorer, you can type
- Press “Enter” to run the command.
- The above action starts the process immediately.
- You can close the Command Prompt window after running the command.
Note: If a process requires elevated permissions, you need to open Command Prompt as admin. To do that, select “Run as administrator” in step 2.
Stopping or Killing a Process
Let’s say your File Explorer is frozen and you have a difficult time opening the Task Manager. In that case, you can use Command Prompt to terminate the process (stop process). Here’s how.
- Open the Start menu by pressing the “Windows” key on your keyboard.
- Search for “Command Prompt” and select “Open“.
- Run
tasklist
to list all the running processes. - It shows the process name and process ID under the “Image Name” and “PID” columns respectively.
- Note down the Image Name and PID of the process you want to kill or stop.
- Run one of the following commands, replacing the placeholder with the actual value you noted:
- The above command instantly kills the process.
- You can close the Command Prompt window after running the command.
Note: If a process requires elevated permissions, you need to open Command Prompt as admin. To do that, select “Run as administrator” in step 2.
Command Flag Explanation
- /im: Specifies that you are targeting the process by its Image Name (process name)
- /PID: Specifies that you are targeting the process by its Process ID.
- /F: Forcefully terminates the process. While you can omit this flag, doing so only attempts a graceful shutdown of the process and may not work if the target process is frozen or unresponsive.
Starting and Stopping Processes Using PowerShell
Similar to Command Prompt, PowerShell has specific cmdlets that allow you to start and stop/kill a process.
Starting a Process
- Open the Start menu by clicking the “Windows” icon on the taskbar.
- Search for “PowerShell” and click “Open“.
- Run the
Start-Process "C:\path\to\process.exe"
while replacing the dummy path between quotes with the actual path to the process.- Programs in the system PATH, like “explorer.exe” or “notepad.exe”, don’t require a full path. For example, to start Windows Explorer, you can type
Start-Process explorer.exe
.
- Programs in the system PATH, like “explorer.exe” or “notepad.exe”, don’t require a full path. For example, to start Windows Explorer, you can type
- Press “Enter” to run the command.
- The above action starts the process immediately.
- You can close the PowerShell window after running the command.
Note: If a process requires elevated permissions, you need to open PowerShell as admin. To do that, select “Run as administrator” in step 2.
Stopping or Killing a Process
Just like with Command Prompt, before you can kill a process, you need to know its name or ID. In PowerShell, you can get the ID of any process using the Get-Process
cmdlet and then kill it using the Stop-Process
cmdlet. Here’s how.
- Open the Start menu by clicking the “Windows” icon on the taskbar.
- Search for “PowerShell” and click “Open“.
- In the PowerShell window, run the
Get-Process
cmdlet to list all the running processes. - You can find the process IDs under the “ID” column. Note down the process ID of the process you want to terminate.
- Run
Stop-Process -Force -ID process_id
while replacing “process_id” with the actual ID of the process you want to kill.- (Example: Stop-Process -Force -ID 1234)
- The above command instantly kills the process.
- You can close the PowerShell window after running the command.
Note: If a process requires elevated permissions, you need to open PowerShell as admin. To do that, select “Run as administrator” in step 2.
Command Flag Explanation
- -Force: Forcefully terminates the process. While you can omit this flag, doing so only attempts a graceful shutdown of the process and may not work if the target process is frozen or unresponsive.
- -ID: Specifies that you are targeting the process by its Process ID.
Wrapping Up — Starting and Killing Processes Using Command Prompt and PowerShell
As you can see, whether you want to use Command Prompt or PowerShell, starting, stopping, and killing any process is fairly simple. Keep in mind that system processes, system-level services, and processes started by other users require you to have administrator rights to kill them. Additionally, if a process is frozen and unresponsive, you have to use /F
in Command Prompt and -Force
in PowerShell to forcefully terminate the target process.
If you have any questions or need help, comment below. I’ll be happy to assist.
Launching an executable file is a common task in Windows. Whether you want to open a program, run a script, or execute a command-line tool, the Start-Process command can help you achieve this. In this guide, we will explore how to use the Start-Process command to launch an executable in Windows.
What is the Start-Process Command?
The Start-Process command is a powerful command-line tool in Windows that allows you to start a new process, which can be an application, script, or command-line tool. It provides various options and parameters to customize the behavior of the launched process.
Launching an Executable Using the Start-Process Command
To launch an executable using the Start-Process command, you need to open a Command Prompt or PowerShell window. Here’s the basic syntax of the Start-Process command:
Start-Process -FilePath <path to executable> [options]
The -FilePath
parameter specifies the path to the executable file you want to launch. You can provide either an absolute path or a relative path to the executable. If the executable is located in a directory listed in the system’s PATH environment variable, you can simply specify the executable’s name without the full path.
Let’s say you want to launch an executable called “myprogram.exe” located in the “C:Program FilesMyProgram” directory. You can use the following command:
Start-Process -FilePath "C:Program Files\MyProgram.exe"
This will start the “myprogram.exe” executable.
Additional Options and Parameters
The Start-Process command provides several additional options and parameters to customize the behavior of the launched process. Here are some commonly used ones:
-WorkingDirectory <path>
: Specifies the working directory for the launched process.-ArgumentList <arguments>
: Specifies any command-line arguments to be passed to the executable.-NoNewWindow
: Launches the executable in the same window instead of opening a new window.-Wait
: Waits for the launched process to exit before continuing the script or command.
For example, if you want to launch “myprogram.exe” with the command-line argument “input.txt” and set the working directory to “C:Program FilesMyProgram”, you can use the following command:
Start-Process -FilePath "C:Program Files\myprogram.exe" -ArgumentList "input.txt" -WorkingDirectory "C:Program Files\MyProgram"
This will start the executable with the specified arguments and working directory.
Conclusion
The Start-Process command is a versatile tool that allows you to launch executables in Windows with ease. By understanding its syntax and available options, you can customize the behavior of the launched process according to your needs. Whether you are a system administrator, developer, or power user, the Start-Process command can be a valuable addition to your toolkit.
Remember to experiment with different options and parameters to fully leverage the capabilities of the Start-Process command and streamline your workflow when launching executables in Windows.
-
the
Start-Process
Cmdlet in PowerShell -
the
Start-Process
Cmdlet Parameters -
the Benefits of PowerShell
Start-Process
The Start-Process
cmdlet is a PowerShell command used to start single or more processes in a controlled and managed way. By default, the started process inherits all current PowerShell environments.
The Start-Process
cmdlet can execute or run an executable file, batch script, MS-DOS and PowerShell command, even Java application. In addition, Windows PowerShell can use the Start-Process
cmdlet to specify user profile, windows status, and credentials, etc.
This article will discuss how the Start-Process
cmdlet works and utilize it when writing our scripts.
the Start-Process
Cmdlet in PowerShell
The Start-Process
cmdlet executes one or more processes, executable or script files, or any files that an installed software can open on the computer.
The Start-Process
cmdlet has a basic syntax shown below when using Windows PowerShell.
the Start-Process
Cmdlet Parameters
The Start-Process
cmdlet can use parameters to add more power, functionality, and flexibility to the cmdlet.
Start New Process or Executable
As mentioned, the most basic usage of the Start-Process
command is providing the executable file, batch or script file, or command like the below syntax. For example, a Notepad application will open when called with the following syntax.
Start-Process notepad.exe
Alternatively, the cmdlet can use the -FilePath
parameter to specify the file location we want to execute.
Start-Process -FilePath notepad.exe
We can also specify the complete path of the executable file or batch file below. In the following example, we will execute a batch file located under the D:\scripts
directory in the following example.
Start-Process -FilePath "D:\scripts\backup.bat"
Set Standard Input as File
We can specify a process input with the standard input where provided standard input content is redirected into the given process. In this case, the -RedirectStandardInput
parameter can set a file as input into the newly created process.
Start-Process -FilePath "D:\scripts\backup.bat" -RedirectStandardInput test.txt
In the example syntax above, the backup.bat
executable input comes from the file test.txt
.
Set Standard Output as File
When a process is executed, it may create some output that we can print to the terminal, screen, or file. We can use the -RedirectStandardOutput
parameter to specify the output into a file.
Start-Process -FilePath "D:\scripts\backup.bat" -RedirectStandardOutput test.txt
The backup.bat
executable output comes from the file test.txt
in the example syntax above.
Set Standard Error Output as File
While running a process, errors may occur, and information about these errors is printed into the console or terminal by default. Using the -RedirectStandardError
parameter can redirect the output into a file like below.
Start-Process -FilePath "D:\scripts\backup.bat" -RedirectStandardError errors.txt
In the example syntax above, if we encountered any errors while running the backup.bat
executable, the errors will be printed in the file errors.txt
.
Set Working Directory
By default new process is executed in the current working directory, which is commonly the system drive C:
. However, we can set a new working directory below using the -WorkingDirectory
parameter.
Start-Process notepad.exe -WorkingDirectory "D:\"
For this example,
Create New Environment
Together with our previous parameters discussed in the article, we can merge them into one script block.
The -UseNewEnvironment
parameter specifies that the process runs with its environment variables.
$processOptions = @{
FilePath = "sort.exe"
RedirectStandardInput = "TestSort.txt"
RedirectStandardOutput = "Sorted.txt"
RedirectStandardError = "SortError.txt"
UseNewEnvironment = $true
}
Start-Process @processOptions
Start-Process
in Maximized Window
The Start-Process
command can start a command-line process or a GUI process that may have some GUI.
The script can set the GUI window size with the -WindowStyle
parameter. This parameter can be set as Maximized to maximize the new process window.
Start-Process notepad.exe -WindowStyle Maximized
Start-Process
With a Different User
By default, the started process is executed as the current user privileges. However, the Start-Process
cmdlet can change the process’s privileges with the -Credential
parameter by providing the new user with whom we want to execute the process.
If you type in your username, you will be prompted to enter a password.
Start-Process notepad.exe -Credential <username>
Start-Process
as an Administrator
We can run the application as an administrator with the - Verb
parameter.
Start-Process notepad.exe -Verb RunAs
Note
PowerShell may still need to ask for your confirmation due to your local computer’s User Account Control (UAC) despite running as administrator. We do not recommend entirely disabling UAC for security purposes.
Start-Process
With Specified Arguments
Commands, processes, or batch files may accept single or multiple arguments to get input data.
This input data is called an argument, and the Start-Process
command can provide arguments to the started process with the -ArgumentList
. Provided argument list passed into the processes as arguments.
Start-Process -FilePath "$env:comspec" -ArgumentList "/c", "dir", "`"%systemdrive%\program files`""
the Benefits of PowerShell Start-Process
- Script files only can be opened locally. It is a security technique that prevents remote attacks using Windows PowerShell scripts.
- The cmdlet runs in a scripting environment that Microsoft supports. As long as Windows PowerShell is supported, Microsoft will dedicate resources to keep the language current, with update revisions.
- A vast developer community readily shares knowledge specifically with the
Start-Process
cmdlet. - The cmdlets and system data stores use standard, consistent syntax and naming conventions to share data easily.
- Using this cmdlet, the navigation of the operating system is simplified, which lets users familiarize the file system, the registry, and other data.
- Objects can be easily manipulated directly or sent to other tools or databases.
- Software vendors and developers can build custom tools.
Enjoying our tutorials? Subscribe to DelftStack on YouTube to support us in creating more high-quality video guides. Subscribe
Readers help support Windows Report. We may get a commission if you buy through our links.
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Command Prompt basics: Starting and stopping processes
Using the Command Prompt can be a quick way to launch programs, especially Windows management utilities which might be fiddly to find through search.
We’ll look at a few basic procedures for working with programs and processes.
Launching programs
To launch a program from Command Prompt, simply type its name:
notepad
This will launch a new Notepad instance. The example works because Windows already knows where Notepad is. Command Prompt automatically searches the working directory (the path shown at the start of the prompt line) and Windows system directories when you run a program in this way.
When the executable resides elsewhere, you’ll need to specify its entire path – C:WindowsSystem32notepad
in this example.
An alternative way to launch programs is via the start
command:
start notepad
This has the same effect as the above example. However, the launch mechanism is slightly different – Command Prompt will hand off to Windows itself, which will take care of finding the right program. More locations will be searched, including the entire contents of the PATH
environment variable and “app path” shortcuts defined in the registry (a way of shortening long executable paths using aliases).
Chaining commands
You can chain commands by combining them with an &
character:
dir & notepad
This will display the contents of your working directory in the terminal and then open Notepad.
A variation can be achieved using &&
instead:
dir && notepad
In this form, the second command will only run if the first one executes successfully. Were there to be an error listing your directory contents, Notepad would not open. (Note: You can achieve the inverse using ||
, so dir || notepad
would run Notepad only if the dir
command failed.)
Ending processes
You can also use the Command Prompt to end processes. This is ideal when you need to kill a program but don’t have a mouse to hand, or Task Manager itself is being unresponsive.
taskkill /F /IM "notepad.exe" /T
The above command will immediately kill any running instance of Notepad. Subsitute notepad.exe
for the name of the program you’d like to kill. You can get this information by running tasklist
to view a list of all the currently running processes.
Radu Tyrsina
Radu Tyrsina has been a Windows fan ever since he got his first PC, a Pentium III (a monster at that time).
For most of the kids of his age, the Internet was an amazing way to play and communicate with others, but he was deeply impressed by the flow of information and how easily you can find anything on the web.
Prior to founding Windows Report, this particular curiosity about digital content enabled him to grow a number of sites that helped hundreds of millions reach faster the answer they’re looking for.
Starts one or more processes on the local computer.
Syntax
PowerShellCopy
Start-Process
[-FilePath] <String>
[[-ArgumentList] <String[]>]
[-Credential <PSCredential>]
[-WorkingDirectory <String>]
[-LoadUserProfile]
[-NoNewWindow]
[-PassThru]
[-RedirectStandardError <String>]
[-RedirectStandardInput <String>]
[-RedirectStandardOutput <String>]
[-WindowStyle <ProcessWindowStyle>]
[-Wait]
[-UseNewEnvironment]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PowerShellCopy
Start-Process
[-FilePath] <String>
[[-ArgumentList] <String[]>]
[-WorkingDirectory <String>]
[-PassThru]
[-Verb <String>]
[-WindowStyle <ProcessWindowStyle>]
[-Wait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Start-Process
cmdlet starts one or more processes on the local computer. By default, Start-Process
creates a new process that inherits all the environment variables that are defined in the current process.
To specify the program that runs in the process, enter an executable file or script file, or a file that can be opened using a program on the computer. If you specify a non-executable file, Start-Process
starts the program that’s associated with the file, similar to the Invoke-Item
cmdlet.
You can use the parameters of Start-Process
to specify options, such as loading a user profile, starting the process in a new window, or using alternate credentials.
Examples
Example 1: Start a process that uses default values
This example starts a process that uses the Sort.exe
file in the current folder. The command uses all the default values, including the default window style, working folder, and credentials.
PowerShellCopy
Start-Process -FilePath "sort.exe"
Example 2: Print a text file
This example starts a process that prints the C:\PS-Test\MyFile.txt
file.
PowerShellCopy
Start-Process -FilePath "myfile.txt" -WorkingDirectory "C:\PS-Test" -Verb Print
Example 3: Start a process to sort items to a new file
This example 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.
PowerShellCopy
$processOptions = @{
FilePath = "sort.exe"
RedirectStandardInput = "TestSort.txt"
RedirectStandardOutput = "Sorted.txt"
RedirectStandardError = "SortError.txt"
UseNewEnvironment = $true
}
Start-Process @processOptions
This example uses splatting to pass parameters to the cmdlet. For more information, see about_Splatting.
Example 4: Start a process in a maximized window
This example starts the Notepad.exe
process. It maximizes the window and retains the window until the process completes.
PowerShellCopy
Start-Process -FilePath "notepad" -Wait -WindowStyle Maximized
Example 5: Start PowerShell as an administrator
This example starts PowerShell using the Run as administrator option.
PowerShellCopy
Start-Process -FilePath "powershell" -Verb RunAs
Example 6: Using different verbs to start a process
This example shows how to find the verbs that can be used when starting a process. The available verbs are determined by the filename extension of the file that runs in the process.
PowerShellCopy
$startExe = New-Object System.Diagnostics.ProcessStartInfo -Args powershell.exe
$startExe.verbs
open
runas
runasuser
The example uses New-Object
to create a System.Diagnostics.ProcessStartInfo object for powershell.exe
, the file that runs in the PowerShell process. The Verbs property of the ProcessStartInfo object shows that you can use the Open and RunAs
verbs with powershell.exe
, or with any process that runs a .exe
file.
Example 7: Specifying arguments to the process
Both commands start the Windows command interpreter, issuing a dir
command on the Program Files
folder. Because this foldername contains a space, the value needs surrounded with escaped quotes. Note that the first command specifies a string as ArgumentList. The second command is a string array.
PowerShellCopy
Start-Process -FilePath "$env:comspec" -ArgumentList "/c dir `"%SystemDrive%\Program Files`""
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%SystemDrive%\Program Files`""
Example 8: Run a command as an Administrator using alternate credentials
On Windows, you can run Start-Process -Verb RunAs
to start a process with elevated permissions. This elevates the current user’s context. The Credential parameter allows you to specify an alternate username and password, allowing you to start a process in a different user content. However, the Credential and Verb parameters can’t be used together.
To start a process with elevated rights, using alternate credentials, you must first start PowerShell using the alternate credentials, then use Start-Process
to start the process with elevated rights.
PowerShellCopy
$cred = Get-Credential
$args = '-noprofile -command "Start-Process cmd.exe -Verb RunAs -args /k"'
Start-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args
The example starts cmd.exe
with elevated permissions from a PowerShell session that is running under alternate credentials.
Example 9: Create a detached process on Linux
On Windows, Start-Process
creates an independent process that remains running independently of the launching shell. On non-Windows platforms, the newly started process is attached to the shell that launched. If the launching shell is closed, the child process is terminated.
To avoid terminating the child process on Unix-like platforms, you can combine Start-Process
with nohup
. The following example launches a background instance of PowerShell on Linux that stays alive even after you close the launching session. The nohup
command collects output in file nohup.out
in the current directory.
PowerShellCopy
# Runs for 2 minutes and appends output to ./nohup.out
Start-Process nohup 'pwsh -noprofile -c "1..120 | % { Write-Host . -NoNewline; sleep 1 }"'
In this example, Start-Process
is running the Linux nohup
command, which launches pwsh
as a detached process. For more information, see the man page for nohup.
Parameters
-ArgumentList
Specifies parameters or parameter values to use when this cmdlet starts the process. Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings separated by commas. The cmdlet joins the array into a single string with each element of the array separated by a single space.
The outer quotes of the PowerShell strings aren’t included when the ArgumentList values are passed to the new process. If parameters or parameter values contain a space or quotes, they need to be surrounded with escaped double quotes. For more information, see about_Quoting_Rules.
For the best results, use a single ArgumentList value containing all the arguments and any needed quote characters.
Type: | String[] |
Aliases: | Args |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies a user account that has permission to perform this action. By default, the cmdlet uses the credentials of the current user.
Type a user name, such as User01 or Domain01\User01, or enter a PSCredential object generated by the Get-Credential
cmdlet. If you type a user name, you’re prompted to enter the password.
Credentials are stored in a PSCredential object and the password is stored as a SecureString.
Note
For more information about SecureString data protection, see How secure is SecureString?.
Type: | PSCredential |
Aliases: | RunAs |
Position: | Named |
Default value: | Current user |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-FilePath
Specifies the optional path and filename of the program that runs in the process. Enter the name of an executable file or of a document, such as a .txt
or .doc
file, that’s associated with a program on the computer. This parameter is required.
If you specify only a filename, use the WorkingDirectory parameter to specify the path.
Type: | String |
Aliases: | PSPath, Path |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LoadUserProfile
Indicates that this cmdlet loads the Windows user profile stored in the HKEY_USERS
registry key for the current user. The parameter doesn’t apply to non-Windows systems.
This parameter doesn’t affect the PowerShell profiles. For more information, see about_Profiles.
Type: | SwitchParameter |
Aliases: | Lup |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoNewWindow
Start the new process in the current console window. By default on Windows, PowerShell opens a new window. On non-Windows systems, you never get a new window.
You can’t use the NoNewWindow and WindowStyle parameters in the same command.
The parameter doesn’t apply to non-Windows systems.
Type: | SwitchParameter |
Aliases: | nnw |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
Returns a process object for each process that the cmdlet started. By default, this cmdlet doesn’t generate any output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RedirectStandardError
Specifies a file. This cmdlet sends any errors generated by the process to a file that you specify. Enter the path and filename. By default, the errors are displayed in the console.
Type: | String |
Aliases: | RSE |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RedirectStandardInput
Specifies a file. This cmdlet reads input from the specified file. Enter the path and filename of the input file. By default, the process gets its input from the keyboard.
Type: | String |
Aliases: | RSI |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RedirectStandardOutput
Specifies a file. This cmdlet sends the output generated by the process to a file that you specify. Enter the path and filename. By default, the output is displayed in the console.
Type: | String |
Aliases: | RSO |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UseNewEnvironment
Indicates that this cmdlet uses new environment variables specified for the process. By default, the started process runs with the environment variables inherited from the parent process.
On Windows, when you use UseNewEnvironment, the new process starts only containing the default environment variables defined for the Machine scope. This has the side effect that the $env:USERNAME
is set to SYSTEM. None of the variables from the User scope are included.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Verb
Specifies a verb to use when this cmdlet starts the process. The verbs that are available are determined by the filename extension of the file that runs in the process.
The following table shows the verbs for some common process file types.
File type | Verbs |
---|---|
.cmd | Edit , Open , Print , RunAs , RunAsUser |
.exe | Open , RunAs , RunAsUser |
.txt | Open , Print , PrintTo |
.wav | Open , Play |
To find the verbs that can be used with the file that runs in a process, use the New-Object
cmdlet to create a System.Diagnostics.ProcessStartInfo object for the file. The available verbs are in the Verbs property of the ProcessStartInfo object. For details, see the examples.
The parameter doesn’t apply to non-Windows systems.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Wait
Indicates that this cmdlet waits for the specified process and its descendants to complete before accepting more input. This parameter suppresses the command prompt or retains the window until the processes finish.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet isn’t run.
This parameter was introduced in PowerShell 6.0.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WindowStyle
Specifies the state of the window that’s used for the new process. The default value is Normal
. The acceptable values for this parameter are:
Normal
Hidden
Minimized
Maximized
You can’t use the WindowStyle and NoNewWindow parameters in the same command.
The parameter doesn’t apply to non-Windows systems. When using on non-Windows systems, you never get a new window.
Type: | ProcessWindowStyle |
Accepted values: | Normal, Hidden, Minimized, Maximized |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WorkingDirectory
Specifies the location that the new process should start in. The default is the location of the executable file or document being started. Wildcards aren’t supported. The path must not contain characters that would be interpreted as wildcards.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
You can’t pipe input to this cmdlet.
Outputs
None, System.Diagnostics.Process
This cmdlet generates a System.Diagnostics.Process object, if you specify the PassThru parameter. Otherwise, this cmdlet doesn’t return any output.
Notes
PowerShell includes the following aliases for Start-Process
:
- All platforms
saps
- Windows
start
Native commands are executable files installed in the operating system. These executables can be run from any command-line shell, like PowerShell. Usually you run the command exactly as you would in bash
or cmd.exe
. The Start-Process
cmdlet can be used to run any native commands, but should only be used when you need to control how the command is executed.
Start-Process
is useful for running GUI programs on non-Windows platforms. For example, run Start-Proces gedit
to launch the graphical text editor common the GNOME Desktop environments.
By default, Start-Process
launches a process asynchronously. Control is instantly returned to PowerShell even if the new process is still running.
- On the local system, the launched process lives on independent from the calling process.
- On a remote system, the new process is terminated when the remote session ends, immediately following the
Start-Process
command. Therefore, you can’t useStart-Process
in a remote session expecting the launched process to outlive the session.
If you do need to use Start-Process
in a remote session, invoke it with the Wait parameter. Or you could use other methods to create a new process on the remote system.
When using the Wait parameter, Start-Process
waits for the process tree (the process and all its descendants) to exit before returning control. This is different than the behavior of the Wait-Process
cmdlet, which only waits for the specified processes to exit.
On Windows, the most common use case for Start-Process
is to use the Wait parameter to block progress until the new process exits. On non-Windows system, this is rarely needed since the default behavior for command-line applications is equivalent to Start-Process -Wait
.
This cmdlet is implemented using the Start method of the System.Diagnostics.Process class. For more information about this method, see Process.Start Method.
- about_Quoting_Rules
- Debug-Process
- Get-Process
- Start-Service
- Stop-Process
- Wait-Process