From a7b8792e76471b348a1465ba85437f7da9d9b1dc Mon Sep 17 00:00:00 2001 From: mintty Date: Fri, 22 Nov 2024 00:00:00 +0100 Subject: [PATCH] tweak portable install; support renaming installation dir (#359) --- install-portable.bat | 10 ++++++++-- mkshortcut.vbs | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/install-portable.bat b/install-portable.bat index 0e604d5..e7f74f3 100755 --- a/install-portable.bat +++ b/install-portable.bat @@ -1,5 +1,8 @@ @echo off +echo Installing WSL Terminal Portable +echo Select target folder in popup dialog ... + 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 @@ -14,15 +17,18 @@ if "%f%"=="" ( exit ) +rem call main installation call install "%instdir%" "%instdir%" /P rem create shortcut -cd /D "%instdir%" set instpath=%instdir:~2% +cd /D "%instpath%" set target=%%COMSPEC%% set minttyargs=/C bin\mintty.exe --WSL= --icon=/wsl.ico --configdir=. -~ set bridgeargs= - -set wdir=%instpath% +rem set wdir=%instpath% +rem let mkshortcut set working directory to empty: +set wdir=. set icon=%instpath%\wsl.ico cscript /nologo mkshortcut.vbs "/name:WSL Terminal Portable" diff --git a/mkshortcut.vbs b/mkshortcut.vbs index c93ecbd..5b3fdc2 100755 --- a/mkshortcut.vbs +++ b/mkshortcut.vbs @@ -29,10 +29,14 @@ rem wscript.echo "minttyargs: " & minttyargs rem wscript.echo lnk.Arguments rem Start in: +rem Working directory; Arguments.Named would take "/wdir:C:\..." parameters rem wdir = Wscript.Arguments.Named("wdir") +rem Working directory; function ExpandEnvironmentStrings cannot pass empty wdir = wshell.ExpandEnvironmentStrings("%wdir%") if IsEmpty(wdir) then lnk.WorkingDirectory = "%USERPROFILE%" +elseif wdir = "." then + lnk.WorkingDirectory = "" else lnk.WorkingDirectory = wdir end if