-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclink.bat
64 lines (54 loc) · 1.47 KB
/
clink.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
@echo off
rem -- Copyright (c) 2012 Martin Ridgers
rem -- Portions Copyright (c) 2020-2024 Christopher Antos
rem -- License: http://opensource.org/licenses/MIT
setlocal enableextensions
set clink_profile_arg=
set clink_quiet_arg=
rem -- Mimic cmd.exe's behaviour when starting from the start menu.
if /i "%~1"=="startmenu" (
cd /d "%userprofile%"
shift
)
rem -- Check for the --profile option.
if /i "%~1"=="--profile" (
set clink_profile_arg=--profile "%~2"
shift
shift
)
rem -- Check for the --quiet option.
if /i "%~1"=="--quiet" (
set clink_quiet_arg= --quiet
shift
)
rem -- If the .bat is run without any arguments, then start a cmd.exe instance.
if _%1==_ (
call :launch
goto :end
)
rem -- Test for autorun.
if defined CLINK_NOAUTORUN if /i "%~1"=="inject" if /i "%~2"=="--autorun" goto :end
rem -- Forward to appropriate loader, and endlocal before inject tags the prompt.
if /i "%processor_architecture%"=="x86" (
endlocal
"%~dp0\clink_x86.exe" %*
) else if /i "%processor_architecture%"=="arm64" (
endlocal
"%~dp0\clink_arm64.exe" %*
) else if /i "%processor_architecture%"=="amd64" (
if defined processor_architew6432 (
endlocal
"%~dp0\clink_x86.exe" %*
) else (
endlocal
"%~dp0\clink_x64.exe" %*
)
)
goto :end
:launch
setlocal enableextensions
set WT_PROFILE_ID=
set WT_SESSION=
start "Clink" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg%%clink_quiet_arg%"
endlocal
:end