-
Notifications
You must be signed in to change notification settings - Fork 1
/
active_edit_with_lite.bat
44 lines (34 loc) · 1.09 KB
/
active_edit_with_lite.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
@echo off
set TARGET=__edit_with_lite.reg
:: Find lite.exe absolute path, and normalize to seperate with '\\' instead of
:: which is required by .reg file
for /f "delims=" %%A in ('
PowerShell -NoP "$(Get-Location).Path.Replace('\','\\')"
') do set LITE_EXE=%%A\lite.exe
echo - Absolute path of lite is %LITE_EXE%
:: Generate .reg file
echo - Generating .reg file...
(
echo Windows Registry Editor Version 5.00
echo:
echo [HKEY_CLASSES_ROOT\*\Shell\Lite]
echo @="Edit with Lite"
echo "Icon"="\"%LITE_EXE%\""
echo:
echo [HKEY_CLASSES_ROOT\*\Shell\Lite\command]
echo @="\"%LITE_EXE%\" \"%1\""
echo:
echo [HKEY_CLASSES_ROOT\Directory\Background\shell\Lite]
echo @="Edit with Lite"
echo "Icon"="\"%LITE_EXE%\""
echo:
echo [HKEY_CLASSES_ROOT\Directory\Background\shell\Lite\command]
echo @="\"%LITE_EXE%\" \"%V\""
) > %TARGET%
:: The magic occur here
echo - Requesting add registry to system...
call %TARGET%
:: All done, .reg is no need anymore, delete it!
echo - Removing redundant .reg file...
del %TARGET%
echo - Edit with Lite activation succeed!