Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 33 additions & 32 deletions install.bat
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
REM Check if environment variable VERSION is set
if "%VERSION%"=="" (
REM If not, set it to "latest"
SET VERSION=latest
SET RELEASE_URL=https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-win-64
) else (
SET RELEASE_URL=https://github.com/mamba-org/micromamba-releases/releases/download/%VERSION%/micromamba-win-64
)

RELEASE_URL="https://github.com/mamba-org/micromamba-releases/releases/%VERSION%/download/micromamba-win-64"

REM Download micromamba using curl.exe
curl.exe -L -o micromamba.exe %RELEASE_URL%
curl.exe -L -o micromamba.exe "%RELEASE_URL%"

REM Create a directory for micromamba
MKDIR %LOCALAPPDATA%\micromamba
IF NOT EXIST "%LOCALAPPDATA%\micromamba" MKDIR "%LOCALAPPDATA%\micromamba"

REM Move micromamba.exe to the final directory
MOVE /Y micromamba.exe %LOCALAPPDATA%\micromamba\micromamba.exe
MOVE /Y micromamba.exe "%LOCALAPPDATA%\micromamba\micromamba.exe"

REM check if this is an interactive shell
if "%PROMPT%"=="" (
echo Initializing micromamba in %USERPROFILE%\micromamba
%LOCALAPPDATA%\micromamba\micromamba.exe init -p %USERPROFILE%\micromamba
)

@REM REM Ask user if micromamba should be added to the PATH
@REM ECHO Add micromamba to the PATH?
@REM ECHO y) Yes
@REM ECHO n) No
@REM SET /P ADD_TO_PATH="Enter your choice: "

@REM REM check if add to path is either y or Y (case insensitive)
@REM if "%ADD_TO_PATH:~0,1%"=="y" (
@REM REM Add micromamba to the PATH
@REM echo Adding micromamba to the PATH
@REM setx PATH "%PATH%;%LOCALAPPDATA%\micromamba"
@REM )

REM Ask user if micromamba should be initialized
ECHO Initialize micromamba?
ECHO y) Yes (default)
ECHO n) No
SET /P INITIALIZE="Enter your choice: "

if "%INITIALIZE:~0,1%"=="y" || "%INITIALIZE"=="" (
REM Initialize micromamba
echo Initializing micromamba in %USERPROFILE%\micromamba
%LOCALAPPDATA%\micromamba\micromamba.exe init -p %USERPROFILE%\micromamba
"%LOCALAPPDATA%\micromamba\micromamba.exe" shell init -r "%USERPROFILE%\micromamba"
) else (

@REM REM Ask user if micromamba should be added to the PATH
@REM ECHO Add micromamba to the PATH?
@REM ECHO y) Yes
@REM ECHO n) No
@REM SET /P ADD_TO_PATH="Enter your choice: "

@REM REM check if add to path is either y or Y (case insensitive)
@REM if "%ADD_TO_PATH:~0,1%"=="y" (
@REM REM Add micromamba to the PATH
@REM echo Adding micromamba to the PATH
@REM setx PATH "%PATH%;%LOCALAPPDATA%\micromamba"
@REM )

REM Ask user if micromamba should be initialized
ECHO Initialize micromamba?
ECHO y) Yes (default)
ECHO n) No
SET /P INITIALIZE="Enter your choice: "

if "%INITIALIZE:~0,1%"=="y" || "%INITIALIZE"=="" (
REM Initialize micromamba
echo Initializing micromamba in %USERPROFILE%\micromamba
"%LOCALAPPDATA%\micromamba\micromamba.exe" shell init -r "%USERPROFILE%\micromamba"
)
)
30 changes: 15 additions & 15 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ if ($version -like "1.*" -or $version -like "0.*") {
if ($null -eq $Host.UI.RawUI) {
Write-Output "`nNot an interactive session, initializing micromamba to $Env:UserProfile\micromamba`n"
& $MAMBA_INSTALL_PATH shell init -s powershell $prefixArg $Env:UserProfile\micromamba
}

$choice = Read-Host "Do you want to initialize micromamba for the shell activate command? (Y/n)"
if ($choice -eq "y" -or $choice -eq "Y" -or $choice -eq "") {
$prefix = Read-Host "Enter the path to the micromamba prefix (default: $Env:UserProfile\micromamba)"
if ($prefix -eq "") {
$prefix = "$Env:UserProfile\micromamba"
}

Write-Output "Initializing micromamba in $prefix"
$MAMBA_INSTALL_PATH = Join-Path -Path $Env:LocalAppData -ChildPath micromamba\micromamba.exe
Write-Output $MAMBA_INSTALL_PATH
& $MAMBA_INSTALL_PATH shell init -s powershell $prefixArg $prefix
} else {
Write-Output "`nYou can always initialize powershell or cmd.exe with micromamba by running `nmicromamba shell init -s powershell $prefixArg $Env:UserProfile\micromamba`n"
}
$choice = Read-Host "Do you want to initialize micromamba for the shell activate command? (Y/n)"
if ($choice -eq "y" -or $choice -eq "Y" -or $choice -eq "") {
$prefix = Read-Host "Enter the path to the micromamba prefix (default: $Env:UserProfile\micromamba)"
if ($prefix -eq "") {
$prefix = "$Env:UserProfile\micromamba"
}

Write-Output "Initializing micromamba in $prefix"
$MAMBA_INSTALL_PATH = Join-Path -Path $Env:LocalAppData -ChildPath micromamba\micromamba.exe
Write-Output $MAMBA_INSTALL_PATH
& $MAMBA_INSTALL_PATH shell init -s powershell $prefixArg $prefix
} else {
Write-Output "`nYou can always initialize powershell or cmd.exe with micromamba by running `nmicromamba shell init -s powershell $prefixArg $Env:UserProfile\micromamba`n"
}
}