title: Install Chrome on Windows with a .bat file using PowerShell
body: <p>I was searching around and found a few hints but a few detail pieces are missing.
  Here is what I have:</p>
  
  <p>install-chrome.bat</p>
  
  <pre><code>PowerShell -NoProfile -Command "&amp;{Start-Process PowerShell -ArgumentList '-NoProfile -File install-chrome.ps1' -Verb RunAs}"
  </code></pre>
  
  <p>install-chrome.ps1</p>
  
  <pre><code>$client = New-Object System.Net.WebClient;
  $client.DownloadFile("https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe", ".\ChromeStandaloneSetup64.exe");
  
  .\ChromeStandaloneSetup64.exe /silent /install ;
  </code></pre>
  
  <p>Two things are not working as expected:</p>
  
  <ol>
  <li>I still get a UAC popup even though the posts I found state that the above should start PowerShell in Admin mode.</li>
  <li>I was expecting <code>.\</code> would download the <code>.exe</code> to the directory the <code>.ps1</code> and <code>.bat</code> scripts are located.</li>
  </ol>
  
  <p>Any hints on how to solve this?</p>
  
  <p>EDIT:
  Thanks to the reply from @TheIncorrigible1 I managed to solve the second part. Both options work more or less (it downloads it, but the installation throws an error locally) when I execute them directly in PowerShell:</p>
  
  <p>&lt; V3</p>
  
  <pre><code>$PSScriptRoot = Split-Path -Parent -Path $script:MyInvocation.MyCommand.Path
  $uri = "https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe"
  $path = "$PSScriptRoot\ChromeStandaloneSetup64.exe" 
  
  $client = New-Object System.Net.WebClient
  $client.DownloadFile($uri, $path)
  &amp; $path /install
  </code></pre>
  
  <p>V3+</p>
  
  <pre><code>$uri = "https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe"
  $path = "$PSScriptRoot\ChromeStandaloneSetup64.exe" 
  Invoke-WebRequest -Uri $uri -OutFile $path
  &amp; $path /install
  </code></pre>
  
  <p>But the batch still throws errors:</p>
  
  <pre><code>At line:1 char:62
  + ... tart-Process PowerShell -Verb RunAs -ArgumentList -NoProfile, -File,  ...
  +                                                                 ~
  Missing argument in parameter list.
  At line:1 char:69
  + ... ocess PowerShell -Verb RunAs -ArgumentList -NoProfile, -File, 'C:\Pro ...
  +                                                                 ~
  Missing argument in parameter list.
      + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
      + FullyQualifiedErrorId : MissingArgument
  </code></pre>