2022-03-22 00:00:00 +01:00
|
|
|
@echo off
|
|
|
|
|
2024-11-23 00:00:00 +01:00
|
|
|
chcp 65001 > nul
|
|
|
|
|
2024-11-23 00:00:00 +01:00
|
|
|
if not exist "WSL Terminal Portable.lnk" goto install
|
|
|
|
echo Rebuilding WSL Terminal Portable shortcut
|
|
|
|
set instdir=%~dp0
|
|
|
|
goto shortcut
|
|
|
|
|
|
|
|
:install
|
|
|
|
|
2024-11-22 00:00:00 +01:00
|
|
|
echo Installing WSL Terminal Portable
|
|
|
|
echo Select target folder in popup dialog ...
|
|
|
|
|
2022-03-22 00:00:00 +01:00
|
|
|
set sel="Select folder to place installation of portable wsltty"
|
|
|
|
|
|
|
|
for /f "usebackq delims=" %%f in (`powershell "(new-object -COM Shell.Application).BrowseForFolder(0, '%sel%', 0, 0).self.path"`) do set f=%%f
|
|
|
|
set instdir=%f%\wsltty
|
2024-11-22 00:00:00 +01:00
|
|
|
if exist %f%\LICENSE.mintty set instdir=%f%
|
2022-03-22 00:00:00 +01:00
|
|
|
|
|
|
|
if "%f%"=="" (
|
2024-11-23 00:00:00 +01:00
|
|
|
echo No installation selected
|
|
|
|
pause
|
2022-03-22 00:00:00 +01:00
|
|
|
exit
|
|
|
|
) else if not exist "%f%" (
|
2024-11-23 00:00:00 +01:00
|
|
|
echo Invalid installation folder %instdir%
|
|
|
|
pause
|
2022-03-22 00:00:00 +01:00
|
|
|
exit
|
|
|
|
)
|
|
|
|
|
2024-11-22 00:00:00 +01:00
|
|
|
rem call main installation
|
2022-03-22 00:00:00 +01:00
|
|
|
call install "%instdir%" "%instdir%" /P
|
2024-11-23 00:00:00 +01:00
|
|
|
rem this already changes into "%instdir%"
|
2022-03-22 00:00:00 +01:00
|
|
|
|
2024-11-23 00:00:00 +01:00
|
|
|
rem copy additional portable installation files
|
|
|
|
rem do this after call install as that deletes previous .bat files
|
|
|
|
copy "%~dp0\install-portable.bat" .
|
|
|
|
dir "%instdir%"\install-portable.bat
|
|
|
|
|
|
|
|
:shortcut
|
|
|
|
|
2022-03-22 00:00:00 +01:00
|
|
|
rem create shortcut
|
2024-11-23 00:00:00 +01:00
|
|
|
cd /D "%instdir%"
|
|
|
|
rem set drive-relative path for shortcut working directory and icon
|
2022-03-22 00:00:00 +01:00
|
|
|
set instpath=%instdir:~2%
|
|
|
|
set target=%%COMSPEC%%
|
|
|
|
set minttyargs=/C bin\mintty.exe --WSL= --icon=/wsl.ico --configdir=. -~
|
|
|
|
set bridgeargs= -
|
2024-11-22 00:00:00 +01:00
|
|
|
rem set wdir=%instpath%
|
|
|
|
rem let mkshortcut set working directory to empty:
|
|
|
|
set wdir=.
|
2022-03-22 00:00:00 +01:00
|
|
|
set icon=%instpath%\wsl.ico
|
|
|
|
cscript /nologo mkshortcut.vbs "/name:WSL Terminal Portable"
|
|
|
|
|