-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.vbs
More file actions
39 lines (34 loc) · 1.55 KB
/
Copy pathstart.vbs
File metadata and controls
39 lines (34 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
' Double-click this file on Windows to start Android Media Copier.
' The browser opens automatically. The terminal closes when you close the browser tab.
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
appDir = fso.GetParentFolderName(WScript.ScriptFullName)
shScript = Replace(appDir, "\", "/") & "/start.sh"
' ── Locate Git installation ─────────────────────────────────────────────────
Dim gitRoots(4)
gitRoots(0) = "C:\Program Files\Git"
gitRoots(1) = "C:\Program Files (x86)\Git"
gitRoots(2) = shell.ExpandEnvironmentStrings("%LOCALAPPDATA%\Programs\Git")
gitRoots(3) = shell.ExpandEnvironmentStrings("%ProgramW6432%\Git")
gitRoots(4) = shell.ExpandEnvironmentStrings("%USERPROFILE%\scoop\apps\git\current")
Dim gitRoot
gitRoot = ""
Dim i
For i = 0 To 4
If fso.FileExists(gitRoots(i) & "\usr\bin\mintty.exe") Then
gitRoot = gitRoots(i)
Exit For
End If
Next
If gitRoot <> "" Then
' Launch mintty with --hold=never so the window closes automatically
' when the server shuts down (i.e. when the browser tab is closed).
Dim mintty, bash
mintty = gitRoot & "\usr\bin\mintty.exe"
bash = gitRoot & "\usr\bin\bash.exe"
shell.Run Chr(34) & mintty & Chr(34) & " --hold=never " & _
Chr(34) & bash & Chr(34) & " -l """ & shScript & """", 1, False
Else
' Fall back to start.bat if Git is not installed
shell.Run "cmd /c """ & appDir & "\start.bat""", 1, False
End If