Skip to content

Instantly share code, notes, and snippets.

@aessing
Last active September 10, 2024 09:11
Show Gist options
  • Save aessing/236ef7bba66d724c6de4992ac77b7b60 to your computer and use it in GitHub Desktop.
Save aessing/236ef7bba66d724c6de4992ac77b7b60 to your computer and use it in GitHub Desktop.
Install AzCopy on Windows (PowerShell)
# =============================================================================
# Install AzCopy on Windows (PowerShell)
# https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10
# https://github.com/Azure/azure-storage-azcopy
# -----------------------------------------------------------------------------
# Developer.......: Andre Essing (https://www.andre-essing.de/)
# (https://github.com/aessing)
# (https://twitter.com/aessing)
# (https://www.linkedin.com/in/aessing/)
# -----------------------------------------------------------------------------
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
# =============================================================================
# Download and extract
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing
Expand-Archive ./AzCopy.zip ./AzCopy -Force
# Move AzCopy
mkdir ~\AppData\Local\Programs\AZCopy
Get-ChildItem ./AzCopy/*/azcopy.exe | Move-Item -Destination ~\AppData\Local\Programs\AZCopy\
# Add AzCopy to PATH
$userenv = (Get-ItemProperty -Path 'HKCU:\Environment' -Name Path).path
$newPath = "$userenv;%USERPROFILE%\AppData\Local\Programs\AZCopy;"
New-ItemProperty -Path 'HKCU:\Environment' -Name Path -Value $newPath -Force
# Clean the kitchen
del -Force AzCopy.zip
del -Force -Recurse .\AzCopy\
@Simon-Syd
Copy link

many thanks !

@marceloaraujor
Copy link

Tks!

@mistyn8
Copy link

mistyn8 commented Jan 30, 2024

Great.. hopefully improved slightly here https://gist.github.com/mistyn8/a53828bdc6da9299836cfd4073d61d8e using %AppDataLocal% and to check we don't keep appending the env var with every run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment