Daniel Ritz
unread,Jul 14, 2011, 5:40:50 AM7/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
  to msysGit
The new "Git Bash.vbs" that allows UNC paths breaks the behavior of
non-UNC version: Since a temporary shortcut is created, it's
impossible to change settings like CMDs "Quick Edit Mode" permanently
which is
very annoying.
My solution to the problem is easy: Use the old way of opening the
bash for normal directories, the new way
for UNC paths. My version of "Git Bash.vbs":
Dim unc : unc = False
If WScript.Arguments.Length=1 Then
	If Left(WScript.Arguments(0), 2) = "\\" Then
		Dim shell : Set shell = CreateObject("WScript.Shell")
		Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
		Dim gitdir : gitdir =
Left(WScript.ScriptFullName,InStrRev(WScript.ScriptFullName,"\"))
		Dim bash : bash = fso.BuildPath(gitdir, "bin\sh.exe")
		Dim temp : temp = fso.GetSpecialFolder(2) ' Temporary folder
		Dim linkfile : linkfile = fso.BuildPath(temp, fso.GetTempName() &
".lnk")
		Dim link : Set link = shell.CreateShortCut(linkfile)
		link.TargetPath = bash
		link.Arguments = "--login -i"
		link.WindowStyle = 1
		If WScript.Arguments.Length > 0 Then link.WorkingDirectory =
WScript.Arguments(0)
		link.Save
		Dim app : Set app = CreateObject("Shell.Application")
		app.ShellExecute linkfile
		WScript.Sleep 500
		fso.DeleteFile linkfile
		unc = True
	Else
		' If there is an argument, use it as the directory to change to.
		Set WshObj = CreateObject("WScript.Shell")
		WshObj.CurrentDirectory = WScript.Arguments(0)
	End If
End If
If unc = False Then
	' Launch the shortcut in the current directory which has the same
	' base name as this script.
	Set AppObj = CreateObject("Shell.Application")
	AppObj.ShellExecute(Replace(WScript.ScriptFullName, ".vbs", ".lnk"))
End If