Better way to install Android Studio for all users?
- copies the saved content from the \AppData\Local\Android\Sdk folder above into a custom folder in "C:\Program Files\Android\"
- puts a script in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\" that creates a hard link from "%USERPROFILE%\AppData\Local\Android\Sdk" to "C:\Program Files\Android\custom"
Answers (1)
Hi, I've got an other solution that work fine
1) Log on with an authorized accound for install completely AS with /S /Allusers (for install Studio in c:\program files\...)
2) go to the folder "%USERPROFILE%\AppData\Local\Android\Sdk" and copy/paste all the items in folder (for ex.) "c:\androidcustom"
3) compress it in "androidcustim.zip" file (for win time to the copy process later)
4) make a powershell file with the code below. Save as "c:\temp\CopieAndroidSDK.ps1" :
function Extract-ZipFile
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]
[ValidateNotNullOrEmpty()]
$Name,
[Parameter(Mandatory=$true)]
[string]
[ValidateNotNullOrEmpty()]
$Destination
)
[Reflection.Assembly]::LoadWithPartialName( "System.IO.Compression.FileSystem" )
[System.IO.Compression.ZipFile]::ExtractToDirectory($Name,$Destination)
Get-Item $Destination
}
write-host Extraction en cours. Merci de patienter environ 3min...
$sdk = $env:USERPROFILE + '\appdata\local\android\sdk'
New-Item -type directory -path $sdk
#$SDK = $env:USERPROFILE + '\appdata\local\android\sdk'
Extract-ZipFile -Name C:\temp\androidcustom.zip -Destination $sdk
write-host Extraction terminée.
Start-Sleep -s 30
5) Logoff and logon with a regular account
6) Execute "c:\temp\CopieAndroidSDK.ps1"
7) When finished, run AS
8) At startup, the wizard comes; answer to the little questions. At last screen, it will wrote "nothing to do, up to date!"
nota : if you make not the ".zip" file, the copy process (+40'000files) takes more time (~8 minutes). With compressed files : ~3 minutes.
:-)
Thanks a ton for figuring all this out and then posting about it. You were are a life saver! - saphirekosmos 6 years ago