mirror of
				https://github.com/mintty/wsltty.git
				synced 2025-11-04 09:01:52 +00:00 
			
		
		
		
	tweak portable install; support renaming installation dir (#359)
This commit is contained in:
		@@ -1,5 +1,8 @@
 | 
				
			|||||||
@echo off
 | 
					@echo off
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo Installing WSL Terminal Portable
 | 
				
			||||||
 | 
					echo Select target folder in popup dialog ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set sel="Select folder to place installation of portable wsltty"
 | 
					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
 | 
					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
 | 
						exit
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rem call main installation
 | 
				
			||||||
call install "%instdir%" "%instdir%" /P
 | 
					call install "%instdir%" "%instdir%" /P
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rem create shortcut
 | 
					rem create shortcut
 | 
				
			||||||
cd /D "%instdir%"
 | 
					 | 
				
			||||||
set instpath=%instdir:~2%
 | 
					set instpath=%instdir:~2%
 | 
				
			||||||
 | 
					cd /D "%instpath%"
 | 
				
			||||||
set target=%%COMSPEC%%
 | 
					set target=%%COMSPEC%%
 | 
				
			||||||
set minttyargs=/C bin\mintty.exe --WSL= --icon=/wsl.ico --configdir=. -~
 | 
					set minttyargs=/C bin\mintty.exe --WSL= --icon=/wsl.ico --configdir=. -~
 | 
				
			||||||
set bridgeargs= -
 | 
					set bridgeargs= -
 | 
				
			||||||
set wdir=%instpath%
 | 
					rem set wdir=%instpath%
 | 
				
			||||||
 | 
					rem let mkshortcut set working directory to empty:
 | 
				
			||||||
 | 
					set wdir=.
 | 
				
			||||||
set icon=%instpath%\wsl.ico
 | 
					set icon=%instpath%\wsl.ico
 | 
				
			||||||
cscript /nologo mkshortcut.vbs "/name:WSL Terminal Portable"
 | 
					cscript /nologo mkshortcut.vbs "/name:WSL Terminal Portable"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,10 +29,14 @@ rem wscript.echo "minttyargs: " & minttyargs
 | 
				
			|||||||
rem wscript.echo lnk.Arguments
 | 
					rem wscript.echo lnk.Arguments
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rem Start in:
 | 
					rem Start in:
 | 
				
			||||||
 | 
					rem Working directory; Arguments.Named would take "/wdir:C:\..." parameters
 | 
				
			||||||
rem wdir = Wscript.Arguments.Named("wdir")
 | 
					rem wdir = Wscript.Arguments.Named("wdir")
 | 
				
			||||||
 | 
					rem Working directory; function ExpandEnvironmentStrings cannot pass empty
 | 
				
			||||||
wdir = wshell.ExpandEnvironmentStrings("%wdir%")
 | 
					wdir = wshell.ExpandEnvironmentStrings("%wdir%")
 | 
				
			||||||
if IsEmpty(wdir) then
 | 
					if IsEmpty(wdir) then
 | 
				
			||||||
  lnk.WorkingDirectory = "%USERPROFILE%"
 | 
					  lnk.WorkingDirectory = "%USERPROFILE%"
 | 
				
			||||||
 | 
					elseif wdir = "." then
 | 
				
			||||||
 | 
					  lnk.WorkingDirectory = ""
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  lnk.WorkingDirectory = wdir
 | 
					  lnk.WorkingDirectory = wdir
 | 
				
			||||||
end if
 | 
					end if
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user