11:: Copyright (c) 2012 Martin Ridgers
2- ::
3- :: Permission is hereby granted, free of charge, to any person obtaining a copy
4- :: of this software and associated documentation files (the "Software"), to deal
5- :: in the Software without restriction, including without limitation the rights
6- :: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7- :: copies of the Software, and to permit persons to whom the Software is
8- :: furnished to do so, subject to the following conditions:
9- ::
10- :: The above copyright notice and this permission notice shall be included in
11- :: all copies or substantial portions of the Software.
12- ::
13- :: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14- :: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15- :: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16- :: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17- :: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18- :: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19- :: SOFTWARE.
2+ :: License: http://opensource.org/licenses/MIT
203
214@ echo off
5+ setlocal enableextensions
6+ set clink_profile_arg =
7+ set clink_quiet_arg =
228
239:: Mimic cmd.exe's behaviour when starting from the start menu.
24- if /i " %1 " == " startmenu" (
10+ if /i " %~ 1 " == " startmenu" (
2511 cd /d " %userprofile% "
26- shift /1
12+ shift
2713)
2814
2915:: Check for the --profile option.
30- if /i " %1 " == " --profile" (
16+ if /i " %~ 1 " == " --profile" (
3117 set clink_profile_arg = --profile " %~2 "
32- shift /1
33- shift /1
18+ shift
19+ shift
20+ )
21+
22+ :: Check for the --quiet option.
23+ if /i " %~1 " == " --quiet" (
24+ set clink_quiet_arg = --quiet
25+ shift
3426)
3527
3628:: If the .bat is run without any arguments, then start a cmd.exe instance.
37- if " %1 " == " " (
29+ if _ %1 == _ (
3830 call :launch
3931 goto :end
4032)
4133
34+ :: Test for autorun.
35+ if defined CLINK_NOAUTORUN if /i " %~1 " == " inject" if /i " %~2 " == " --autorun" goto :end
36+
37+ :: Endlocal before inject tags the prompt.
38+ endlocal
39+
4240:: Pass through to appropriate loader.
4341if /i " %processor_architecture% " == " x86" (
4442 " %~dp0 \clink_x86.exe" %*
43+ ) else if /i " %processor_architecture% " == " arm64" (
44+ " %~dp0 \clink_arm64.exe" %*
4545) else if /i " %processor_architecture% " == " amd64" (
4646 if defined processor_architew6432 (
4747 " %~dp0 \clink_x86.exe" %*
@@ -51,10 +51,13 @@ if /i "%processor_architecture%"=="x86" (
5151)
5252
5353:end
54- set clink_profile_arg =
5554goto :eof
5655
5756:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
5857:launch
59- start " Clink" cmd.exe /s /k " " %~dpnx0 " inject %clink_profile_arg% "
58+ setlocal
59+ set WT_PROFILE_ID =
60+ set WT_SESSION =
61+ start " Clink" cmd.exe /s /k " " %~dpnx0 " inject %clink_profile_arg%%clink_quiet_arg% "
62+ endlocal
6063exit /b 0
0 commit comments