|
1 | 1 | @echo off
|
2 | 2 |
|
3 | 3 | rem argument 1: [ /s | /t ] register ime as zh_CN | zh_TW keyboard layout
|
4 |
| -set WEASEL_INSTALL_OPTION=/s |
5 |
| -if /i "%1" == "/t" set WEASEL_INSTALL_OPTION=/t |
| 4 | +set install_option=/s |
| 5 | +if /i "%1" == "/t" set install_option=/t |
6 | 6 |
|
7 | 7 | set CD_BACK=%CD%
|
8 | 8 | cd "%~dp0"
|
9 | 9 |
|
| 10 | +if /i "%2" == "/register" goto register |
| 11 | + |
10 | 12 | echo stopping service from an older version.
|
11 | 13 | call stop_service.bat
|
12 | 14 |
|
13 | 15 | echo configuring preset input schemas...
|
14 | 16 | WeaselDeployer.exe /install
|
15 | 17 |
|
| 18 | +echo administrative permissions required. detecting permissions... |
| 19 | +net session >nul 2>&1 |
| 20 | +if not %errorlevel% == 0 ( |
| 21 | + echo elevating command prompt... |
| 22 | + cscript sudo.js "%~nx0" %install_option% /register |
| 23 | + exit /b |
| 24 | +) |
| 25 | + |
| 26 | +:register |
16 | 27 | echo registering Weasel IME to your system.
|
| 28 | +echo install_option=%install_option% |
17 | 29 |
|
18 |
| -wscript check_windows_version.js |
| 30 | +cscript check_windows_version.js |
19 | 31 | if errorlevel 2 goto win7_x64_install
|
20 | 32 | if errorlevel 1 goto xp_install
|
21 | 33 |
|
22 | 34 | :win7_install
|
23 |
| -wscript sudo.js WeaselSetup.exe %WEASEL_INSTALL_OPTION% |
24 |
| -rem wscript sudo.js regsvr32.exe /s "%CD%\weasel.dll" |
25 |
| -goto exit |
| 35 | +WeaselSetup.exe %install_option% |
| 36 | +rem regsvr32.exe /s "%CD%\weasel.dll" |
| 37 | +goto next |
26 | 38 |
|
27 | 39 | :win7_x64_install
|
28 |
| -wscript sudo.js WeaselSetupx64.exe %WEASEL_INSTALL_OPTION% |
29 |
| -rem wscript sudo.js regsvr32.exe /s "%CD%\weasel.dll" |
30 |
| -rem wscript sudo.js regsvr32.exe /s "%CD%\weaselx64.dll" |
31 |
| -goto exit |
| 40 | +WeaselSetupx64.exe %install_option% |
| 41 | +rem regsvr32.exe /s "%CD%\weasel.dll" |
| 42 | +rem regsvr32.exe /s "%CD%\weaselx64.dll" |
| 43 | +goto next |
32 | 44 |
|
33 | 45 | :xp_install
|
34 |
| -WeaselSetup.exe %WEASEL_INSTALL_OPTION% |
35 |
| -goto exit |
| 46 | +WeaselSetup.exe %install_option% |
| 47 | +goto next |
36 | 48 |
|
37 |
| -:exit |
| 49 | +:next |
38 | 50 | reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" /v WeaselServer /t REG_SZ /d "%CD%\WeaselServer.exe" /f
|
39 |
| -WeaselServer.exe |
| 51 | + |
| 52 | +:done |
| 53 | +start WeaselServer.exe |
| 54 | + |
| 55 | +if /i "%2" == "/register" pause |
| 56 | +echo installed. |
40 | 57 | cd "%CD_BACK%"
|
0 commit comments