-
Notifications
You must be signed in to change notification settings - Fork 1
/
addHexterToShellCtxtMenu.bat
79 lines (60 loc) · 1.48 KB
/
addHexterToShellCtxtMenu.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
echo off
setlocal
set bin_path=
set label=Open with Hexter
set prog_name=%~n0
set user_dir="%~dp0"
set verbose=0
GOTO :ParseParams
:ParseParams
if [%1]==[/?] goto help
if [%1]==[/h] goto help
if [%1]==[/help] goto help
IF "%~1"=="/p" (
SET bin_path=%~2
SHIFT
goto reParseParams
)
IF "%~1"=="/l" (
SET label=%~2
SHIFT
goto reParseParams
)
IF "%~1"=="/v" (
SET verbose=1
goto reParseParams
)
:reParseParams
SHIFT
if [%1]==[] goto main
GOTO :ParseParams
:main
if ["%bin_path%"] == [] goto usage
if ["%bin_path%"] == [""] goto usage
if ["%label%"] == [] goto usage
if ["%label%"] == [""] goto usage
IF not exist "%bin_path%" (
echo Hexter not found at "%bin_path%"!
echo Place it there or adjust the bin_path.
exit /b 0
)
if [%verbose%]==[1] (
echo bin_path=%bin_path%
echo label=%label%
)
:add
C:\Windows\System32\reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\%label%\Command" /t REG_SZ /d "cmd /k %bin_path% -file \"%%1\""
endlocal
exit /B 0
:usage
echo Usage: %prog_name% /p "c:\bin\hexter.exe" [/l "Open in Hexter"] [/v] [/h]
exit /B 0
:help
call :usage
echo.
echo /p Path to the hexter binary. Must not have spaces at the moment!
echo /l Label to show up in the context menu.
echo /v Verbose mode.
echo /h Print this.
endlocal
exit /B 0