{"id":434,"date":"2022-10-28T13:52:32","date_gmt":"2022-10-28T13:52:32","guid":{"rendered":"https:\/\/merserver.com\/?p=434"},"modified":"2022-10-28T13:52:32","modified_gmt":"2022-10-28T13:52:32","slug":"powershell-start-process-reference-and-documentation","status":"publish","type":"post","link":"http:\/\/merserver.com\/index.php\/2022\/10\/28\/powershell-start-process-reference-and-documentation\/","title":{"rendered":"Powershell Start-Process Reference and Documentation"},"content":{"rendered":"\n<p>Starts one or more processes on the local computer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#syntax\"><\/a>Syntax<\/h2>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process\n     &#91;-FilePath] &lt;String&gt;\n     &#91;&#91;-ArgumentList] &lt;String&#91;]&gt;]\n     &#91;-Credential &lt;PSCredential&gt;]\n     &#91;-WorkingDirectory &lt;String&gt;]\n     &#91;-LoadUserProfile]\n     &#91;-NoNewWindow]\n     &#91;-PassThru]\n     &#91;-RedirectStandardError &lt;String&gt;]\n     &#91;-RedirectStandardInput &lt;String&gt;]\n     &#91;-RedirectStandardOutput &lt;String&gt;]\n     &#91;-WindowStyle &lt;ProcessWindowStyle&gt;]\n     &#91;-Wait]\n     &#91;-UseNewEnvironment]\n     &#91;-WhatIf]\n     &#91;-Confirm]\n     &#91;&lt;CommonParameters&gt;]<\/code><\/pre>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process\n     &#91;-FilePath] &lt;String&gt;\n     &#91;&#91;-ArgumentList] &lt;String&#91;]&gt;]\n     &#91;-WorkingDirectory &lt;String&gt;]\n     &#91;-PassThru]\n     &#91;-Verb &lt;String&gt;]\n     &#91;-WindowStyle &lt;ProcessWindowStyle&gt;]\n     &#91;-Wait]\n     &#91;-WhatIf]\n     &#91;-Confirm]\n     &#91;&lt;CommonParameters&gt;]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"description\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#description\"><\/a>Description<\/h2>\n\n\n\n<p>The&nbsp;<code>Start-Process<\/code>&nbsp;cmdlet starts one or more processes on the local computer. By default,&nbsp;<code>Start-Process<\/code>&nbsp;creates a new process that inherits all the environment variables that are defined in the current process.<\/p>\n\n\n\n<p>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,&nbsp;<code>Start-Process<\/code>&nbsp;starts the program that&#8217;s associated with the file, similar to the&nbsp;<code>Invoke-Item<\/code>&nbsp;cmdlet.<\/p>\n\n\n\n<p>You can use the parameters of&nbsp;<code>Start-Process<\/code>&nbsp;to specify options, such as loading a user profile, starting the process in a new window, or using alternate credentials.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"examples\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#examples\"><\/a>Examples<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-1-start-a-process-that-uses-default-values\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-1-start-a-process-that-uses-default-values\"><\/a>Example 1: Start a process that uses default values<\/h3>\n\n\n\n<p>This example starts a process that uses the&nbsp;<code>Sort.exe<\/code>&nbsp;file in the current folder. The command uses all the default values, including the default window style, working folder, and credentials.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"sort.exe\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-2-print-a-text-file\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-2-print-a-text-file\"><\/a>Example 2: Print a text file<\/h3>\n\n\n\n<p>This example starts a process that prints the&nbsp;<code>C:\\PS-Test\\MyFile.txt<\/code>&nbsp;file.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"myfile.txt\" -WorkingDirectory \"C:\\PS-Test\" -Verb Print<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-3-start-a-process-to-sort-items-to-a-new-file\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-3-start-a-process-to-sort-items-to-a-new-file\"><\/a>Example 3: Start a process to sort items to a new file<\/h3>\n\n\n\n<p>This example starts a process that sorts items in the&nbsp;<code>TestSort.txt<\/code>&nbsp;file and returns the sorted items in the&nbsp;<code>Sorted.txt<\/code>&nbsp;files. Any errors are written to the&nbsp;<code>SortError.txt<\/code>&nbsp;file. The&nbsp;<strong>UseNewEnvironment<\/strong>&nbsp;parameter specifies that the process runs with its own environment variables.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$processOptions = @{\n    FilePath = \"sort.exe\"\n    RedirectStandardInput = \"TestSort.txt\"\n    RedirectStandardOutput = \"Sorted.txt\"\n    RedirectStandardError = \"SortError.txt\"\n    UseNewEnvironment = $true\n}\nStart-Process @processOptions<\/code><\/pre>\n\n\n\n<p>This example uses splatting to pass parameters to the cmdlet. For more information, see&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.core\/about\/about_splatting?view=powershell-7.2\">about_Splatting<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-4-start-a-process-in-a-maximized-window\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-4-start-a-process-in-a-maximized-window\"><\/a>Example 4: Start a process in a maximized window<\/h3>\n\n\n\n<p>This example starts the&nbsp;<code>Notepad.exe<\/code>&nbsp;process. It maximizes the window and retains the window until the process completes.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"notepad\" -Wait -WindowStyle Maximized<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-5-start-powershell-as-an-administrator\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-5-start-powershell-as-an-administrator\"><\/a>Example 5: Start PowerShell as an administrator<\/h3>\n\n\n\n<p>This example starts PowerShell using the&nbsp;<strong>Run as administrator<\/strong>&nbsp;option.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"powershell\" -Verb RunAs<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-6-using-different-verbs-to-start-a-process\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-6-using-different-verbs-to-start-a-process\"><\/a>Example 6: Using different verbs to start a process<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$startExe = New-Object System.Diagnostics.ProcessStartInfo -Args powershell.exe\n$startExe.verbs\n\nopen\nrunas\nrunasuser<\/code><\/pre>\n\n\n\n<p>The example uses&nbsp;<code>New-Object<\/code>&nbsp;to create a&nbsp;<strong>System.Diagnostics.ProcessStartInfo<\/strong>&nbsp;object for&nbsp;<code>powershell.exe<\/code>, the file that runs in the PowerShell process. The&nbsp;<strong>Verbs<\/strong>&nbsp;property of the&nbsp;<strong>ProcessStartInfo<\/strong>&nbsp;object shows that you can use the&nbsp;<strong>Open<\/strong>&nbsp;and&nbsp;<code>RunAs<\/code>&nbsp;verbs with&nbsp;<code>powershell.exe<\/code>, or with any process that runs a&nbsp;<code>.exe<\/code>&nbsp;file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-7-specifying-arguments-to-the-process\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-7-specifying-arguments-to-the-process\"><\/a>Example 7: Specifying arguments to the process<\/h3>\n\n\n\n<p>Both commands start the Windows command interpreter, issuing a&nbsp;<code>dir<\/code>&nbsp;command on the&nbsp;<code>Program Files<\/code>&nbsp;folder. Because this foldername contains a space, the value needs surrounded with escaped quotes. Note that the first command specifies a string as&nbsp;<strong>ArgumentList<\/strong>. The second command is a string array.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"$env:comspec\" -ArgumentList \"\/c dir `\"%SystemDrive%\\Program Files`\"\"\nStart-Process -FilePath \"$env:comspec\" -ArgumentList \"\/c\",\"dir\",\"`\"%SystemDrive%\\Program Files`\"\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-8-run-a-command-as-an-administrator-using-alternate-credentials\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-8-run-a-command-as-an-administrator-using-alternate-credentials\"><\/a>Example 8: Run a command as an Administrator using alternate credentials<\/h3>\n\n\n\n<p>On Windows, you can run&nbsp;<code>Start-Process -Verb RunAs<\/code>&nbsp;to start a process with elevated permissions. This elevates the current user&#8217;s context. The&nbsp;<strong>Credential<\/strong>&nbsp;parameter allows you to specify an alternate username and password, allowing you to start a process in a different user content. However, the&nbsp;<strong>Credential<\/strong>&nbsp;and&nbsp;<strong>Verb<\/strong>&nbsp;parameters can&#8217;t be used together.<\/p>\n\n\n\n<p>To start a process with elevated rights, using alternate credentials, you must first start PowerShell using the alternate credentials, then use&nbsp;<code>Start-Process<\/code>&nbsp;to start the process with elevated rights.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cred = Get-Credential\n$args = '-noprofile -command \"Start-Process cmd.exe -Verb RunAs -args \/k\"'\nStart-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args<\/code><\/pre>\n\n\n\n<p>The example starts&nbsp;<code>cmd.exe<\/code>&nbsp;with elevated permissions from a PowerShell session that is running under alternate credentials.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-9-create-a-detached-process-on-linux\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#example-9-create-a-detached-process-on-linux\"><\/a>Example 9: Create a detached process on Linux<\/h3>\n\n\n\n<p>On Windows,&nbsp;<code>Start-Process<\/code>&nbsp;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.<\/p>\n\n\n\n<p>To avoid terminating the child process on Unix-like platforms, you can combine&nbsp;<code>Start-Process<\/code>&nbsp;with&nbsp;<code>nohup<\/code>. The following example launches a background instance of PowerShell on Linux that stays alive even after you close the launching session. The&nbsp;<code>nohup<\/code>&nbsp;command collects output in file&nbsp;<code>nohup.out<\/code>&nbsp;in the current directory.<\/p>\n\n\n\n<p>PowerShellCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Runs for 2 minutes and appends output to .\/nohup.out\nStart-Process nohup 'pwsh -noprofile -c \"1..120 | % { Write-Host . -NoNewline; sleep 1 }\"'<\/code><\/pre>\n\n\n\n<p>In this example,&nbsp;<code>Start-Process<\/code>&nbsp;is running the Linux&nbsp;<code>nohup<\/code>&nbsp;command, which launches&nbsp;<code>pwsh<\/code>&nbsp;as a detached process. For more information, see the man page for&nbsp;<a href=\"https:\/\/linux.die.net\/man\/1\/nohup\">nohup<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"parameters\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#parameters\"><\/a>Parameters<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-argumentlist\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-argumentlist\"><\/a>-ArgumentList<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>The outer quotes of the PowerShell strings aren&#8217;t included when the&nbsp;<strong>ArgumentList<\/strong>&nbsp;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&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.core\/about\/about_quoting_rules?view=powershell-7.2\">about_Quoting_Rules<\/a>.<\/p>\n\n\n\n<p>For the best results, use a single&nbsp;<strong>ArgumentList<\/strong>&nbsp;value containing all the arguments and any needed quote characters.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a>[]<\/td><\/tr><tr><td>Aliases:<\/td><td>Args<\/td><\/tr><tr><td>Position:<\/td><td>1<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-confirm\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-confirm\"><\/a>-Confirm<\/h3>\n\n\n\n<p>Prompts you for confirmation before running the cmdlet.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>cf<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-credential\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-credential\"><\/a>-Credential<\/h3>\n\n\n\n<p>Specifies a user account that has permission to perform this action. By default, the cmdlet uses the credentials of the current user.<\/p>\n\n\n\n<p>Type a user name, such as&nbsp;<strong>User01<\/strong>&nbsp;or&nbsp;<strong>Domain01\\User01<\/strong>, or enter a&nbsp;<strong>PSCredential<\/strong>&nbsp;object generated by the&nbsp;<code>Get-Credential<\/code>&nbsp;cmdlet. If you type a user name, you&#8217;re prompted to enter the password.<\/p>\n\n\n\n<p>Credentials are stored in a&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.pscredential\">PSCredential<\/a>&nbsp;object and the password is stored as a&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.security.securestring\">SecureString<\/a>.<\/p>\n\n\n\n<p>&nbsp;Note<\/p>\n\n\n\n<p>For more information about&nbsp;<strong>SecureString<\/strong>&nbsp;data protection, see&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.security.securestring#how-secure-is-securestring\">How secure is SecureString?<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.pscredential\">PSCredential<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>RunAs<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>Current user<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-filepath\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-filepath\"><\/a>-FilePath<\/h3>\n\n\n\n<p>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&nbsp;<code>.txt<\/code>&nbsp;or&nbsp;<code>.doc<\/code>&nbsp;file, that&#8217;s associated with a program on the computer. This parameter is required.<\/p>\n\n\n\n<p>If you specify only a filename, use the&nbsp;<strong>WorkingDirectory<\/strong>&nbsp;parameter to specify the path.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>PSPath, Path<\/td><\/tr><tr><td>Position:<\/td><td>0<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-loaduserprofile\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-loaduserprofile\"><\/a>-LoadUserProfile<\/h3>\n\n\n\n<p>Indicates that this cmdlet loads the Windows user profile stored in the&nbsp;<code>HKEY_USERS<\/code>&nbsp;registry key for the current user. The parameter doesn&#8217;t apply to non-Windows systems.<\/p>\n\n\n\n<p>This parameter doesn&#8217;t affect the PowerShell profiles. For more information, see&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.core\/about\/about_profiles?view=powershell-7.2\">about_Profiles<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>Lup<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-nonewwindow\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-nonewwindow\"><\/a>-NoNewWindow<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>You can&#8217;t use the&nbsp;<strong>NoNewWindow<\/strong>&nbsp;and&nbsp;<strong>WindowStyle<\/strong>&nbsp;parameters in the same command.<\/p>\n\n\n\n<p>The parameter doesn&#8217;t apply to non-Windows systems.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>nnw<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-passthru\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-passthru\"><\/a>-PassThru<\/h3>\n\n\n\n<p>Returns a process object for each process that the cmdlet started. By default, this cmdlet doesn&#8217;t generate any output.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-redirectstandarderror\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-redirectstandarderror\"><\/a>-RedirectStandardError<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>RSE<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-redirectstandardinput\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-redirectstandardinput\"><\/a>-RedirectStandardInput<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>RSI<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-redirectstandardoutput\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-redirectstandardoutput\"><\/a>-RedirectStandardOutput<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>RSO<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-usenewenvironment\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-usenewenvironment\"><\/a>-UseNewEnvironment<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>On Windows, when you use&nbsp;<strong>UseNewEnvironment<\/strong>, the new process starts only containing the default environment variables defined for the&nbsp;<strong>Machine<\/strong>&nbsp;scope. This has the side effect that the&nbsp;<code>$env:USERNAME<\/code>&nbsp;is set to&nbsp;<strong>SYSTEM<\/strong>. None of the variables from the&nbsp;<strong>User<\/strong>&nbsp;scope are included.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-verb\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-verb\"><\/a>-Verb<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>The following table shows the verbs for some common process file types.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>File type<\/th><th>Verbs<\/th><\/tr><\/thead><tbody><tr><td>.cmd<\/td><td><code>Edit<\/code>,&nbsp;<code>Open<\/code>,&nbsp;<code>Print<\/code>,&nbsp;<code>RunAs<\/code>,&nbsp;<code>RunAsUser<\/code><\/td><\/tr><tr><td>.exe<\/td><td><code>Open<\/code>,&nbsp;<code>RunAs<\/code>,&nbsp;<code>RunAsUser<\/code><\/td><\/tr><tr><td>.txt<\/td><td><code>Open<\/code>,&nbsp;<code>Print<\/code>,&nbsp;<code>PrintTo<\/code><\/td><\/tr><tr><td>.wav<\/td><td><code>Open<\/code>,&nbsp;<code>Play<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To find the verbs that can be used with the file that runs in a process, use the&nbsp;<code>New-Object<\/code>&nbsp;cmdlet to create a&nbsp;<strong>System.Diagnostics.ProcessStartInfo<\/strong>&nbsp;object for the file. The available verbs are in the&nbsp;<strong>Verbs<\/strong>&nbsp;property of the&nbsp;<strong>ProcessStartInfo<\/strong>&nbsp;object. For details, see the examples.<\/p>\n\n\n\n<p>The parameter doesn&#8217;t apply to non-Windows systems.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-wait\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-wait\"><\/a>-Wait<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-whatif\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-whatif\"><\/a>-WhatIf<\/h3>\n\n\n\n<p>Shows what would happen if the cmdlet runs. The cmdlet isn&#8217;t run.<\/p>\n\n\n\n<p>This parameter was introduced in PowerShell 6.0.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.management.automation.switchparameter\">SwitchParameter<\/a><\/td><\/tr><tr><td>Aliases:<\/td><td>wi<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-windowstyle\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-windowstyle\"><\/a>-WindowStyle<\/h3>\n\n\n\n<p>Specifies the state of the window that&#8217;s used for the new process. The default value is&nbsp;<code>Normal<\/code>. The acceptable values for this parameter are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>Normal<\/code><\/li><li><code>Hidden<\/code><\/li><li><code>Minimized<\/code><\/li><li><code>Maximized<\/code><\/li><\/ul>\n\n\n\n<p>You can&#8217;t use the&nbsp;<strong>WindowStyle<\/strong>&nbsp;and&nbsp;<strong>NoNewWindow<\/strong>&nbsp;parameters in the same command.<\/p>\n\n\n\n<p>The parameter doesn&#8217;t apply to non-Windows systems. When using on non-Windows systems, you never get a new window.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.diagnostics.processwindowstyle\">ProcessWindowStyle<\/a><\/td><\/tr><tr><td>Accepted values:<\/td><td>Normal, Hidden, Minimized, Maximized<\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-workingdirectory\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#-workingdirectory\"><\/a>-WorkingDirectory<\/h3>\n\n\n\n<p>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&#8217;t supported. The path must not contain characters that would be interpreted as wildcards.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Type:<\/td><td><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.string\">String<\/a><\/td><\/tr><tr><td>Position:<\/td><td>Named<\/td><\/tr><tr><td>Default value:<\/td><td>None<\/td><\/tr><tr><td>Accept pipeline input:<\/td><td>False<\/td><\/tr><tr><td>Accept wildcard characters:<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inputs\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#inputs\"><\/a>Inputs<\/h2>\n\n\n\n<p><strong>None<\/strong><\/p>\n\n\n\n<p>You can&#8217;t pipe input to this cmdlet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"outputs\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#outputs\"><\/a>Outputs<\/h2>\n\n\n\n<p><strong>None, System.Diagnostics.Process<\/strong><\/p>\n\n\n\n<p>This cmdlet generates a&nbsp;<strong>System.Diagnostics.Process<\/strong>&nbsp;object, if you specify the&nbsp;<strong>PassThru<\/strong>&nbsp;parameter. Otherwise, this cmdlet doesn&#8217;t return any output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"notes\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#notes\"><\/a>Notes<\/h2>\n\n\n\n<p>PowerShell includes the following aliases for&nbsp;<code>Start-Process<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>All platforms<ul><li><code>saps<\/code><\/li><\/ul><\/li><li>Windows<ul><li><code>start<\/code><\/li><\/ul><\/li><\/ul>\n\n\n\n<p>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&nbsp;<code>bash<\/code>&nbsp;or&nbsp;<code>cmd.exe<\/code>. The&nbsp;<code>Start-Process<\/code>&nbsp;cmdlet can be used to run any native commands, but should only be used when you need to control how the command is executed.<\/p>\n\n\n\n<p><code>Start-Process<\/code>&nbsp;is useful for running GUI programs on non-Windows platforms. For example, run&nbsp;<code>Start-Proces gedit<\/code>&nbsp;to launch the graphical text editor common the GNOME Desktop environments.<\/p>\n\n\n\n<p>By default,&nbsp;<code>Start-Process<\/code>&nbsp;launches a process&nbsp;<em>asynchronously<\/em>. Control is instantly returned to PowerShell even if the new process is still running.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>On the local system, the launched process lives on independent from the calling process.<\/li><li>On a remote system, the new process is terminated when the remote session ends, immediately following the&nbsp;<code>Start-Process<\/code>&nbsp;command. Therefore, you can&#8217;t use&nbsp;<code>Start-Process<\/code>&nbsp;in a remote session expecting the launched process to outlive the session.<\/li><\/ul>\n\n\n\n<p>If you do need to use&nbsp;<code>Start-Process<\/code>&nbsp;in a remote session, invoke it with the&nbsp;<strong>Wait<\/strong>&nbsp;parameter. Or you could use other methods to create a new process on the remote system.<\/p>\n\n\n\n<p>When using the&nbsp;<strong>Wait<\/strong>&nbsp;parameter,&nbsp;<code>Start-Process<\/code>&nbsp;waits for the process tree (the process and all its descendants) to exit before returning control. This is different than the behavior of the&nbsp;<code>Wait-Process<\/code>&nbsp;cmdlet, which only waits for the specified processes to exit.<\/p>\n\n\n\n<p>On Windows, the most common use case for&nbsp;<code>Start-Process<\/code>&nbsp;is to use the&nbsp;<strong>Wait<\/strong>&nbsp;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&nbsp;<code>Start-Process -Wait<\/code>.<\/p>\n\n\n\n<p>This cmdlet is implemented using the&nbsp;<strong>Start<\/strong>&nbsp;method of the&nbsp;<strong>System.Diagnostics.Process<\/strong>&nbsp;class. For more information about this method, see&nbsp;<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.diagnostics.process.start#overloads\">Process.Start Method<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"related-links\"><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-process?view=powershell-7.2#related-links\"><\/a>Related Links<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.core\/about\/about_quoting_rules?view=powershell-7.2\">about_Quoting_Rules<\/a><\/li><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/debug-process?view=powershell-7.2\">Debug-Process<\/a><\/li><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/get-process?view=powershell-7.2\">Get-Process<\/a><\/li><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/start-service?view=powershell-7.2\">Start-Service<\/a><\/li><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/stop-process?view=powershell-7.2\">Stop-Process<\/a><\/li><li><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/microsoft.powershell.management\/wait-process?view=powershell-7.2\">Wait-Process<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Starts one or more processes on the local computer. Syntax PowerShellCopy PowerShellCopy Description The&nbsp;Start-Process&nbsp;cmdlet starts one or more processes on the local computer. By default,&nbsp;Start-Process&nbsp;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&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"http:\/\/merserver.com\/index.php\/2022\/10\/28\/powershell-start-process-reference-and-documentation\/\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Powershell Start-Process Reference and Documentation&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-434","post","type-post","status-publish","format-standard","hentry","category-it"],"_links":{"self":[{"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":1,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":435,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/posts\/434\/revisions\/435"}],"wp:attachment":[{"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/merserver.com\/index.php\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}