-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtenTweaker.cmd
116 lines (80 loc) · 3.27 KB
/
tenTweaker.cmd
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
@echo off
chcp 65001>nul
setlocal EnableExtensions EnableDelayedExpansion
pushd "%~dp0"
set program_name=Ten Tweaker
set program_name_ns=%~n0
set program_version=3.0 Alpha 1
set program_version_number=30011
set module_choice=bin\choice.exe /n
set module_elevate=bin\elevate.vbs
set module_powershell=start /wait /min "" powershell -ep bypass -nop -w 1
set module_wget=bin\wget.exe --quiet --no-check-certificate --tries=1
set appxMgmt=call bin\lib.cmd :appxMgmt
set getState=call bin\lib.cmd :getState
set logo=call bin\lib.cmd :logo
set main=call bin\main.cmd
set reboot_computer=call bin\main.cmd :reboot_computer
set restartExplorer=call bin\lib.cmd :restartExplorer
set sBuilder_build=call set sBuilder_text=%%sBuilder_text%%
set settings_apply=call bin\lib.cmd :settings_apply
set settings_import=for /f "eol=# delims=" %%i in ('type "settings.ini" 2^^^>nul') do call set setting_%%i
set settings_save=call bin\lib.cmd :settings_save
set key_elevate=false
set key_hiddenOptions=false
set key_reboot=null
set key_skipRegMerge=false
:parser
set temp_key=%1
set temp_value=%2
if "!temp_key!" NEQ "" set temp_key=!temp_key:"=!
if "!temp_key!" NEQ "" (
set temp_key=!temp_key:~1!
if /i "!temp_key!" == "elevate" ( set key_!temp_key!=true
) else if /i "!temp_key!" == "hiddenOptions" ( set key_!temp_key!=true
) else if /i "!temp_key!" == "reboot" ( set key_!temp_key!=!temp_value:"=!
shift /1 )
shift /1
goto :parser
)
set setting_firstRun=true
set setting_language=english
net session>nul 2>nul
if "!errorLevel!" == "0" (
set state_admin_privileges=true
) else set state_admin_privileges=false
set update_version_output=temp\%program_name_ns%.version
set update_version_url=https://drive.google.com/uc?export=download^^^&id=1ZeM5bnX0fWs7njKL2ZTeYc2ctv0FmGRs
if "%key_elevate%" == "false" if "%state_admin_privileges%" == "false" (
set args=
if "%key_hiddenOptions%" == "true" set args=!args! /key_hiddenOptions
if "%key_reboot%" NEQ "null" set args=!args! /reboot !key_reboot!
%module_elevate% "%cd%" "%~nx0" !args! /elevate
exit
)
if not exist "temp" md "temp"
%settings_import%
if "%setting_firstRun%" == "true" (
set setting_firstRun=false
%settings_apply%
%main% :language_menu force
) else %settings_apply%
(
if "%key_reboot%" == "sppsvc" (
for /l %%i in (1,1, 4) do rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %cd%\res\unHookExec.inf
for /l %%i in (1,1, 4) do reg import res\sppsvc.reg
for /l %%i in (1,1,10) do sc start sppsvc
for /l %%i in (1,1, 4) do reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v %program_name_ns%_services_sppsvc /f
%reboot_computer% force
) else (
%module_wget% "%update_version_url%" --output-document="%update_version_output%"
for /f "tokens=1-3 delims=." %%i in (%update_version_output%) do (
if "%%k" NEQ "" (
set update_program_version_number=%%i%%j%%k
) else set update_program_version_number=%%i%%j0
)
if !update_program_version_number! GTR %program_version_number% echo.>temp\return_update_available
)
)>nul 2>nul
%main% :main_menu
exit