title: How to hide windows when installing python from Powershell
body: <p>I'm new to python, I'm trying to use a script to automatically install python from Powershell, the following:</p>
  <pre><code># This is the link to download Python 3.6.7 from Python.org
  # See https://www.python.org/downloads/
  $pythonUrl = &quot;https://www.python.org/ftp/python/3.6.7/python-3.6.7-amd64.exe&quot;
  
  # This is the directory that the exe is downloaded to
  $tempDirectory = &quot;C:\temp_provision\&quot;
  
  # Installation Directory
  # Some packages look for Python here
  $targetDir = &quot;C:\Python36&quot;
  
  # create the download directory and get the exe file
  $pythonNameLoc = $tempDirectory + &quot;python367.exe&quot;
  New-Item -ItemType directory -Path $tempDirectory -Force | Out-Null
  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  (New-Object System.Net.WebClient).DownloadFile($pythonUrl, $pythonNameLoc)
  
  # These are the silent arguments for the install of python
  # See https://docs.python.org/3/using/windows.html
  $Arguments = @()
  $Arguments += &quot;/i&quot;
  $Arguments += 'InstallAllUsers=&quot;1&quot;'
  $Arguments += 'TargetDir=&quot;' + $targetDir + '&quot;'
  $Arguments += 'DefaultAllUsersTargetDir=&quot;' + $targetDir + '&quot;'
  $Arguments += 'AssociateFiles=&quot;1&quot;'
  $Arguments += 'PrependPath=&quot;1&quot;'
  $Arguments += 'Include_doc=&quot;1&quot;'
  $Arguments += 'Include_debug=&quot;1&quot;'
  $Arguments += 'Include_dev=&quot;1&quot;'
  $Arguments += 'Include_exe=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'InstallLauncherAllUsers=&quot;1&quot;'
  $Arguments += 'Include_lib=&quot;1&quot;'
  $Arguments += 'Include_pip=&quot;1&quot;'
  $Arguments += 'Include_symbols=&quot;1&quot;'
  $Arguments += 'Include_tcltk=&quot;1&quot;'
  $Arguments += 'Include_test=&quot;1&quot;'
  $Arguments += 'Include_tools=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += 'Include_launcher=&quot;1&quot;'
  $Arguments += &quot;/passive&quot;
  
  #Install Python
  Start-Process $pythonNameLoc -ArgumentList $Arguments -Wait
  
  Function Get-EnvVariableNameList {
      [cmdletbinding()]
      $allEnvVars = Get-ChildItem Env:
      $allEnvNamesArray = $allEnvVars.Name
      $pathEnvNamesList = New-Object System.Collections.ArrayList
      $pathEnvNamesList.AddRange($allEnvNamesArray)
      return ,$pathEnvNamesList
  }
  
  Function Add-EnvVarIfNotPresent {
  Param (
  [string]$variableNameToAdd,
  [string]$variableValueToAdd
     ) 
      $nameList = Get-EnvVariableNameList
      $alreadyPresentCount = ($nameList | Where{$_ -like $variableNameToAdd}).Count
      if ($alreadyPresentCount -eq 0)
      {
      [System.Environment]::SetEnvironmentVariable($variableNameToAdd, $variableValueToAdd, [System.EnvironmentVariableTarget]::Machine)
      [System.Environment]::SetEnvironmentVariable($variableNameToAdd, $variableValueToAdd, [System.EnvironmentVariableTarget]::Process)
      [System.Environment]::SetEnvironmentVariable($variableNameToAdd, $variableValueToAdd, [System.EnvironmentVariableTarget]::User)
          $message = &quot;Enviromental variable added to machine, process and user to include $variableNameToAdd&quot;
      }
      else
      {
          $message = 'Environmental variable already exists. Consider using a different function to modify it'
      }
      Write-Information $message
  }
  
  Function Get-EnvExtensionList {
      [cmdletbinding()]
      $pathExtArray =  ($env:PATHEXT).Split(&quot;{;}&quot;)
      $pathExtList = New-Object System.Collections.ArrayList
      $pathExtList.AddRange($pathExtArray)
      return ,$pathExtList
  }
  
  Function Add-EnvExtension {
  Param (
  [string]$pathExtToAdd
     ) 
      $pathList = Get-EnvExtensionList
      $alreadyPresentCount = ($pathList | Where{$_ -like $pathToAdd}).Count
      if ($alreadyPresentCount -eq 0)
      {
          $pathList.Add($pathExtToAdd)
          $returnPath = $pathList -join &quot;;&quot;
          [System.Environment]::SetEnvironmentVariable('pathext', $returnPath, [System.EnvironmentVariableTarget]::Machine)
          [System.Environment]::SetEnvironmentVariable('pathext', $returnPath, [System.EnvironmentVariableTarget]::Process)
          [System.Environment]::SetEnvironmentVariable('pathext', $returnPath, [System.EnvironmentVariableTarget]::User)
          $message = &quot;Path extension added to machine, process and user paths to include $pathExtToAdd&quot;
      }
      else
      {
          $message = 'Path extension already exists'
      }
      Write-Information $message
  }
  
  Function Get-EnvPathList {
      [cmdletbinding()]
      $pathArray =  ($env:PATH).Split(&quot;{;}&quot;)
      $pathList = New-Object System.Collections.ArrayList
      $pathList.AddRange($pathArray)
      return ,$pathList
  }
  
  Function Add-EnvPath {
  Param (
  [string]$pathToAdd
     ) 
      $pathList = Get-EnvPathList
      $alreadyPresentCount = ($pathList | Where{$_ -like $pathToAdd}).Count
      if ($alreadyPresentCount -eq 0)
      {
          $pathList.Add($pathToAdd)
          $returnPath = $pathList -join &quot;;&quot;
          [System.Environment]::SetEnvironmentVariable('path', $returnPath, [System.EnvironmentVariableTarget]::Machine)
          [System.Environment]::SetEnvironmentVariable('path', $returnPath, [System.EnvironmentVariableTarget]::Process)
          [System.Environment]::SetEnvironmentVariable('path', $returnPath, [System.EnvironmentVariableTarget]::User)
          $message = &quot;Path added to machine, process and user paths to include $pathToAdd&quot;
      }
      else
      {
          $message = 'Path already exists'
      }
      Write-Information $message
  }
  
  Add-EnvExtension '.PY'
  Add-EnvExtension '.PYW'
  Add-EnvPath 'C:\Python36\' 
  </code></pre>
  <p>only that when I start it I get this pop-up:</p>
  <p><a href="https://i.stack.imgur.com/UXPMs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UXPMs.png" alt="enter image description here" /></a></p>
  <p>how can i not display this window and start the default installation? Then is there a way to not show windows during installation? thank you very much for helping. Any advice on how to streamline the code is welcome</p>