Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

WinGit: Fix several regressions with the VB helper script

The changes in eec84b0 introduced several regressions:

- The window icon is no longer set to the Git icon
- The window title is a random name instead of "Git Bash"
- Changes to the window properties can no longer be saved because the
  dynamically created shortcut is automatically deleted

This commit fixes the above issues while maintaining compatibility with UNC
paths. This is done by:

- Specifying an icon location
- Always using "Git Bash" instead of a random name
- Not automatically deleting the shortcut from the temporary directory

The last two points should not be a problem as "CreateShortCut" does not
overwrite but opens existing shortcuts.

Finally, the code was cleaned-up and simplified.

Signed-off-by: Sebastian Schuberth <>
Signed-off-by: Johannes Schindelin <>
  • Loading branch information...
commit bb9ea52d3da3655798b827dedfc03512e3943ae2 1 parent 03cd806
@sschuberth sschuberth authored dscho committed
Showing with 9 additions and 13 deletions.
  1. +9 −13 share/WinGit/Git Bash.vbs
22 share/WinGit/Git Bash.vbs
@@ -1,20 +1,16 @@
-Option Explicit
+Set fso = CreateObject("Scripting.FileSystemObject")
+Set shell = CreateObject("WScript.Shell")
-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")
+linkfile = fso.BuildPath(fso.GetSpecialFolder(TemporaryFolder), "Git Bash.lnk")
+gitdir = fso.GetParentFolderName(WScript.ScriptFullName)
-Dim link : Set link = shell.CreateShortCut(linkfile)
-link.TargetPath = bash
+' Dynamically create a shortcut with the current directory as the working directory.
+Set link = shell.CreateShortcut(linkfile)
+link.TargetPath = fso.BuildPath(gitdir, "bin\sh.exe")
link.Arguments = "--login -i"
-link.WindowStyle = 1
+link.IconLocation = fso.BuildPath(gitdir, "etc\git.ico")
If WScript.Arguments.Length > 0 Then link.WorkingDirectory = WScript.Arguments(0)
-Dim app : Set app = CreateObject("Shell.Application")
+Set app = CreateObject("Shell.Application")
app.ShellExecute linkfile
-WScript.Sleep 500
-fso.DeleteFile linkfile

0 comments on commit bb9ea52

Please sign in to comment.
Something went wrong with that request. Please try again.