This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-cmd.bat
178 lines (158 loc) · 6.19 KB
/
start-cmd.bat
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
@echo off
rem Copyright (C): 2001, 2002, 2003, 2004, 2005 Earnie Boyd
rem mailto:[email protected]
rem This file is part of Minimal SYStem
rem http://www.mingw.org/msys.shtml
rem
rem File: msys.bat
rem Revision: 2.4
rem Revision Date: December 8th, 2005
rem ember to set the "Start in:" field of the shortcut.
rem A value similar to C:\msys\1.0\bin is what the "Start in:" field needs
rem to represent.
rem ember value of GOTO: is used to know recursion has happened.
if "%1" == "GOTO:" goto %2
if NOT "x%WD%" == "x" set WD=
rem ember command.com only uses the first eight characters of the label.
goto _WindowsNT
rem ember that we only execute here if we are in command.com.
:_Windows
if "x%COMSPEC%" == "x" set COMSPEC=command.com
start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto EOF
rem ember that we execute here if we recursed.
:_Resume
for %%F in (1 2 3) do shift
if NOT EXIST %WD%msys-1.0.dll set WD=.\bin\
rem ember that we get here even in command.com.
:_WindowsNT
rem Hopefully a temporary workaround for getting MSYS shell to run on x64
rem (WoW64 cmd prompt sets PROCESSOR_ARCHITECTURE to x86)
if not "x%PROCESSOR_ARCHITECTURE%" == "xAMD64" goto _NotX64
set COMSPEC=%WINDIR%\SysWOW64\cmd.exe
%COMSPEC% /c %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto EOF
:_NotX64
if NOT EXIST %WD%msys-1.0.dll set WD=%~dp0bin\
rem ember Set up option to use rxvt based on value of %1
set MSYSCON=unknown
if "x%1" == "x-norxvt" set MSYSCON=sh.exe
if "x%1" == "x--norxvt" set MSYSCON=sh.exe
if "x%1" == "x-rxvt" set MSYSCON=rxvt.exe
if "x%1" == "x--rxvt" set MSYSCON=rxvt.exe
if "x%1" == "x-mintty" set MSYSCON=mintty.exe
if "x%1" == "x--mintty" set MSYSCON=mintty.exe
if NOT "x%MSYSCON%" == "xunknown" shift
if "x%MSYSCON%" == "xunknown" set MSYSCON=sh.exe
if "x%MSYSTEM%" == "x" set MSYSTEM=MINGW32
if "%1" == "MINGW32" set MSYSTEM=MINGW32
if "%1" == "MSYS" set MSYSTEM=MSYS
if NOT "x%DISPLAY%" == "x" set DISPLAY=
if "x%MSYSCON%" == "xsh.exe" goto startsh
:unknowncon
echo %MSYSCON% is an unknown option for msys.bat.
pause
exit 1
:notfound
echo Cannot find the rxvt.exe or sh.exe binary -- aborting.
pause
exit 1
:startsh
if NOT EXIST %WD%sh.exe goto notfound
echo %WD%
start "Shell" "%WD%\sh" --login -i
exit
:EOF
rem ChangeLog:
rem 2002.03.07 Earnie Boyd mailto:[email protected]
rem * Move the @echo off to the top.
rem * Change the binmode setting to nobinmode.
rem * Remove the angle brackets around email address to workaround MS
rem buggy command processor.
rem
rem 2002.03.12 Earnie Boyd mailto:[email protected]
rem * Add filter logic to find rxvt.exe
rem
rem 2002.03.13 Earnie Boyd mailto:[email protected]
rem * Revert the nobinmode change.
rem
rem 2002.03.20 Earnie Boyd mailto:[email protected]
rem * Add logic for stating bash.
rem
rem 2002.04.11 Earnie Boyd mailto;[email protected]
rem * Add logic for setting MSYSTEM value based on parameter.
rem
rem 2002.04.15 Olivier Gautherot mailto:[email protected]
rem * Reduce number test conditions for finding an executable.
rem
rem 2002.04.15 Earnie Boyd mailto:[email protected]
rem * Unset DISPLAY if set before starting shell.
rem
rem 2002.04.16 Earnie Boyd mailto:[email protected]
rem * Remove use of DEFINED in conditional statments for variables for
rem command.com support.
rem * Add check for nonexistance of USERNAME variable for Win9x support.
rem
rem 2002.04.17 Earnie Boyd mailto:[email protected]
rem * Add foreground and background color defaults based on MSYSTEM value.
rem
rem 2002.04.22 Earnie Boyd mailto:[email protected]
rem * More Win 9x changes.
rem
rem 2002.05.04 Earnie Boyd mailto:[email protected]
rem * Remove the SET of USERNAME and HOME.
rem
rem 2002.11.18 Earnie Boyd mailto:[email protected]
rem * Add command.com detection and restart with a larger environment to
rem avoid errors on w9x.
rem Many thanks to Randy W. Sims mailto:[email protected].
rem See Randy's response to "RE: [Mingw-msys] Installation on WindowsME"
rem from 11/06/2002 in the archives of [email protected].
rem
rem 2002.11.19 Paul Garceau mailto:[email protected]
rem * Fix a typo: Change COMPSPEC to COMSPEC.
rem
rem 2002.11.25 Earnie Boyd mailto:[email protected]
rem * Remove the SET CYGWIN since it doesn't matter any longer.
rem
rem 2003.02.03 Earnie Boyd mailto:[email protected]
rem * Win9x doesn't like ``EXISTS dir'' so change it to ``EXISTS dir\nul''.
rem Thanks to Nicolas Weber mailto:[email protected].
rem
rem 2003.03.06 Earnie Boyd mailto:[email protected]
rem * Add -backspacekey switch to rxvt startup.
rem * Move RXVT color setup to startrxvt label
rem
rem 2004.01.30 Earnie Boyd mailto:[email protected]
rem * Add -geometry parameter to work around an off by one issue with
rem the default values.
rem Thanks to Dave Schuyler mailto:[email protected]
rem
rem 2004.03.28 Earnie Boyd mailto:[email protected]
rem * Add -norxvt or --norxvt switch argument.
rem Thanks to Keith Marshall mailto:[email protected].
rem * Add method to determine absolute path of msys.bat so that we no
rem longer need to change to the bin directory. This allows msys.bat to be
rem called from any working directory.
rem Thanks to Kevin Mack mailto:[email protected]
rem
rem 2005.07.06 Max TE Woodbury mailto:[email protected]
rem * Fixed WD check for command.com systems.
rem * Minimized intermediate CMD window to reduce startup flashyness.
rem * If rxvt.exe cannot be found, try sh.exe.
rem
rem 2005.12.06 Tuomo Latto mailto:[email protected]
rem * Added a temporary workaround for getting MSYS shell to run on x64.
rem
rem 2005.12.07 Keith Marshall mailto:[email protected]
rem * ``EXISTS %WD%\sh.exe'' should be ``EXISTS %WD%sh.exe''; corrected.
rem * Modified Tuomo's patch, to avoid trashing Window settings in Win32.
rem
rem 2005.12.08 Tuomo Latto mailto:[email protected]
rem * Keith's modified patch fails on x64; start did funny things.
rem Reworked, for correct behaviour on both platforms.
rem
rem 2009.03.17 Keith Marshall mailto:[email protected]
rem * Add -rxvt or --rxvt switch; start in --norxvt mode by default.
rem Make it deterministic; (do not inherit MSYSCON from parent).
rem