1
0
mirror of https://github.com/mintty/wsltty.git synced 2025-01-18 12:05:47 +00:00
wsltty/install-portable.bat

55 lines
1.4 KiB
Batchfile
Raw Normal View History

2022-03-22 00:00:00 +01:00
@echo off
2024-11-23 00:00:00 +01:00
chcp 65001 > nul
if not exist "WSL Terminal Portable.lnk" goto install
echo Rebuilding WSL Terminal Portable shortcut
set instdir=%~dp0
goto shortcut
:install
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
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
)
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
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= -
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"