title: How to launch a portable install of Android Studio directly, bypassing the Setup Wizard, In Powershell Script?
body: <p>So everyone loves Android Studio's awesome portability, don't they?</p>
  
  <p>I've got the SDK and all its components installed on a portable drive, and can use it anywhere. A quick Powershell script is all I need to get it up and running.
  The script sets all of my environmental variables, and launches the Studio and an emulator saved on my disk.</p>
  
  <p>But...
  Every time the Studio is launched in a new environment (like a new computer), it starts with its built in Setup Wizard.
  Annoying.
  So, if I cancel the setup, I'm prompted with an option to skip the wizard on the next launch. After selecting this option, The studio launches fine.</p>
  
  <p>Can the community help me with overiding the setup wizard on the first launch?
  Here's the script:</p>
  
  <pre><code>#***************************************************************************************#
  #***************************************************************************************#
  #                                                                                       #
  #                       Portable Android SDK Environment Setup                          #
  #                                 Powershell Script                                     #
  #                                                                                       #
  #                                   By: sh7411usa                                       #
  #                                                                                       #
  #                      For Use With Portable Drive Installation                         #
  #                                                                                       #
  #                                                                                       #
  #***************************************************************************************#
  #***************************************************************************************#
  
  #Configure Execution Policy
  Set-ExecutionPolicy Bypass -Scope Process -Force
  
  #Display Welcome to User
  Write-Output ""
  Write-Output "**************************************************************************"
  Write-Output "**************************************************************************"
  Write-Output "**                                                                      **"
  Write-Output "**                                                                      **"
  Write-Output "**                    Android SDK Environment Setup                     **"
  Write-Output "**                                                                      **"
  Write-Output "**                                                                      **"
  Write-Output "**************************************************************************"
  Write-Output "**************************************************************************"
  Write-Output `n
  
  #Advise of Execution Policy
  $outStr = (get-ExecutionPolicy) | Out-String
  Write-Host -NoNewline "Checking Execution Policy... "
  Write-Host $outStr
  
  #Set Working Directory (containing path to Android SDK installation):
  $BpathTo = (Get-Item -Path ".\").FullName
  
  #Update for User Specific data, (usually found under "C:\Users\User\"):
  #ANDROID_SDK_HOME
  #ANDROID_EMULATOR_HOME
  #ANDROID_AVD_HOME 
  $pathTo = "$BpathTo\User"
  Write-Host -NoNewline "Setting ANDROID_SDK_HOME to:      $pathTo"
  [Environment]::SetEnvironmentVariable("ANDROID_SDK_HOME", $pathTo, "Machine")
  Write-Output "              ...Done"
  $pathTo+="\.android"
  Write-Host -NoNewline "Setting ANDROID_EMULATOR_HOME to: $pathTo"
  [Environment]::SetEnvironmentVariable("ANDROID_EMULATOR_HOME", $pathTo, "Machine")
  Write-Output "     ...Done"
  $pathTo+="\avd"
  Write-Host -NoNewline "Setting ANDROID_AVD_HOME to:      $pathTo"
  [Environment]::SetEnvironmentVariable("ANDROID_AVD_HOME", $pathTo, "Machine")
  Write-Output " ...Done"
  #Create/Update ANDOID_HOME environmental variable:
  ### The Program data, usually found under "C:\Program Files (x86)\Android Studio\"
  $pathTo = "$BpathTo\SDK"
  Write-Host -NoNewline "Setting ANDROID_SDK_ROOT to:      $pathTo"
  [Environment]::SetEnvironmentVariable("ANDROID_SDK_ROOT", $pathTo, "Machine")
  Write-Output "               ...Done"
  Write-Host -NoNewline "Setting ANDROID_HOME to:          $pathTo"
  [Environment]::SetEnvironmentVariable("ANDROID_HOME", $pathTo, "Machine")
  Write-Output "               ...Done
  "
  Write-Output "Keep up to date on Android Studio's environmental variables:
  https://developer.android.com/studio/command-line/variables
  "
  
  #Update PATH environmental variable:
  Write-Output "Updating PATH:"
  $pathTo = "$BpathTo\SDK"
  $new1="$pathTo"+"\tools;"
  $new2="$pathTo"+"\tools\bin;"
  $new3="$pathTo"+"\platform-tools;"
  $newPath=";"+$new1+$new2+$new3
  Write-Output "Adding: $new1"
  Write-Output "Adding: $new2"
  Write-Output "Adding: $new3"
  $new4="$BpathTo"+"\User;"
  Write-Output "Adding: $new4"
  $newPath+=$new4
  $env:Path+=$newPath
  Write-Output ""
  Write-Output "Done... Environment Setup Has Finished."
  Write-Output ""
  
  #Install Chocolatey and choco packages:
  $InstallChoco = $False
  ##TODO:##if (Get-Command choco.exe -ErrorAction SilentlyContinue) {$InstallChoco = $true} #tests if choco.exe exists
  If(Test-Path -Path "$env:ProgramData\Chocolatey") {} Else {$InstallChoco=$true} #tests if choco exists in $env:
  if ($InstallChoco){ #Installs choco if not already installed
      Write-Output "Installing 'Chocolatey Installer'"
      iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      Write-Output `n}
  $Packages = 'ADB', 'NotepadPlusPlus' #&lt;-- Add packages here
  ForEach ($PackageName in $Packages){ #installs choco packages listed above, one by one.
      Write-Output "Attempting Chocolatey Install: $PackageName"
      choco install --force $PackageName -y 
      Write-Output `n}
  
  #Launch the Studio:
  $pathTo = "$BpathTo\android-studio\bin\studio64.exe"
  Write-Output "Starting Process: ANDROID STUDIO (x64)"
  Write-Output "Initiating @ $pathTo"
  Start-Process $pathTo
  Write-Output `n
  
  #Startup the Emulator:
  ##TODO:##See above link regarding setting emulator variables.
  ##First, update the emulator's *.ini to match the current directory:
  $avdPath="$BpathTo\User\.android\avd\Nexus_x86.ini"
  Write-Host -NoNewline "Updating Emulator: $avdPath..."
  if (Test-Path $avdPath){Remove-Item $avdPath}
  New-Item $avdPath | Out-Null
  Clear-Content $avdPath
  Set-Content $avdPath "avd.ini.encoding=UTF-8
  path=$BpathTo\User\.android\avd\Nexus_x86.avd
  path.rel=avd\Nexus_x86.avd
  target=android-24"
  Write-Output "Done"
  
  ##Second, Launch the emulator:
  Write-Output "Launching: 'Nexus_x86' Emulator..."
  $arg="-avd Nexus_x86"
  $pathTo = "$Bpathto\localInstall\emulator\emulator.exe"
  SDK\emulator\emulator.exe -avd Nexus_x86
  Write-Output `n
  
  #Wait for user response to close the window
  Write-Host -NoNewLine "Script Finished. Press any key to close this window..."
  $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  </code></pre>
  
  <p>In this picture, I detailed the steps mentioned above to cancel the setup wizard.</p>
  
  <p>I'm looking to skip this step, and get straight to the Studio. Any help is appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/OHuuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OHuuy.png" alt="Cancelling The Setup Wizard:"></a></p>