Переглянути джерело

#IQRV #comment 添加开机自启动设置

80374374 1 рік тому
батько
коміт
fa01afd31e
2 змінених файлів з 125 додано та 116 видалено
  1. 61 45
      addin/packaging/WIN/installbat.in
  2. 64 71
      addin/packaging/WIN/original.bat

+ 61 - 45
addin/packaging/WIN/installbat.in

@@ -49,8 +49,7 @@ echo [RVCTermianal] ========== Install Start ==========
 ) else (
 	@set rvc_install_path_root=C:
 )
-@set rvc_runtime_dir=%rvc_install_path_root%\VTMDepencies
-
+@set lnkPath=spexplorerauto.lnk
 @echo install type: %installType%
 
 tasklist /nh | find /i "spshell.exe"
@@ -77,11 +76,13 @@ tasklist /nh | find /i "spshell.exe"
 @echo rvc_src_path_Run_dir=%rvc_src_path_Run_dir%
 
 @set rvc_install_path_rvc_dir=%rvc_install_path_root%\rvc
+@set rvc_install_path_rvc_res_dir=%rvc_install_path_root%\rvc\Resources
 @set rvc_install_path_Run_dir=%rvc_install_path_root%\Run
 @set rvc_install_path_hardware_dir=%rvc_install_path_Run_dir%\hardwarecfg
 @set rvc_install_path_versions_dir=%rvc_install_path_Run_dir%\version
 
 @echo rvc_install_path_rvc_dir=%rvc_install_path_rvc_dir%
+@echo rvc_install_path_rvc_res_dir=%rvc_install_path_rvc_res_dir%
 @echo rvc_install_path_Run_dir=%rvc_install_path_Run_dir%
 @echo rvc_install_path_hardware_dir=%rvc_install_path_hardware_dir%
 @echo rvc_install_path_versions_dir=%rvc_install_path_versions_dir%
@@ -96,7 +97,14 @@ tasklist /nh | find /i "spshell.exe"
 	)
 )
 
+@if %installType% equ 4 (
+	@if exist %rvc_install_path_Run_dir% rd /S /Q %rvc_install_path_Run_dir%
+	@if exist %rvc_install_path_rvc_dir% rd /S /Q %rvc_install_path_rvc_dir%
+	@goto setAutoStartWithRegist
+)
+
 @if not exist "%rvc_install_path_rvc_dir%" md "%rvc_install_path_rvc_dir%"
+@if not exist "%rvc_install_path_rvc_res_dir%" md "%rvc_install_path_rvc_res_dir%"
 @if not exist "%rvc_install_path_Run_dir%" md "%rvc_install_path_Run_dir%"
 @if not exist "%rvc_install_path_hardware_dir%" md "%rvc_install_path_hardware_dir%"
 @if not exist "%rvc_install_path_versions_dir%" md "%rvc_install_path_versions_dir%"
@@ -105,47 +113,11 @@ tasklist /nh | find /i "spshell.exe"
 @xcopy %rvc_src_path_rvc_dir% %rvc_install_path_rvc_dir%  /E/Y/Q
 @echo 【1/1】拷贝RVC目录OK!
 
-
 @echo 【1/2】拷贝终端版本...
 @if exist %rvc_src_path_Run_dir%\hardwarecfg ( xcopy %rvc_src_path_Run_dir%\hardwarecfg %rvc_install_path_hardware_dir%  /E/Y/Q )
 @xcopy %rvc_src_path_Run_dir%\version %rvc_install_path_versions_dir%  /E/Y/Q
 @echo 【2/2】拷贝终端版本OK!
 
-@rem 不再分离出基础库文件
-@goto SkipInstallRuntime
-@echo 运行时基础文件存放路径 %rvc_runtime_dir%
-@if exist %rvc_runtime_dir% rd /S /Q %rvc_runtime_dir%
-if not exist "%rvc_runtime_dir%" md "%rvc_runtime_dir%"
-
-@echo 【2/3】拷贝基础运行时依赖文件...
-@xcopy %rvc_src_path_runbase_dir% %rvc_runtime_dir%  /E/Y/Q
-@echo 【3/3】拷贝基础运行时依赖文件OK!
-
-@echo 【3/4】设置系统环境变量...
-@set OldPath=%PATH%
-@set /a maxlen=1024
-@set /a num=0
-@set /a updateFlag=0
-@echo current path: %OldPath%
-@echo "%OldPath%" | findstr "%rvc_runtime_dir%" > nul && (
-	@echo [INFO]: 系统变量中已包含基础运行库文件目录路径
-) || (
-	@echo [INFO]: 系统变量中不包含基础运行库文件目录路径,开始设置...
-	@call :stringLenth "%OldPath%" num
-	@set updateFlag=1
-)
-@if %updateFlag% equ 1 (
-	@echo [DEBUG]: length: %num%
-	@if %num% geq 1024 (
-		@call :ColorText 4F "[ERROR] 已有的环境变量内容大于1024,无法通过程序更新系统环境PATH,请手工将值%rvc_runtime_dir%添加到PATH系统环境中,然后再运行此安装脚本"
-		@goto InstallError
-	)
-)
-
-@echo 【4/4】设置系统环境变量成功
-
-:SkipInstallRuntime
-
 @set FileCount=0
 @set desk_path=%USERPROFILE%\Desktop
 @echo desk_path=%desk_path%
@@ -157,13 +129,16 @@ if not exist "%rvc_runtime_dir%" md "%rvc_runtime_dir%"
 	@call :ColorText E0 "[WARN] 桌面不允许留存任何其他无关文件!"
 )
 
+@echo 【2/3】设置可视柜台应用程序开机自启动
+
+@echo installType=%installType%
 @if %installType% neq 1 (
 	@if %installType% neq 4 (
-		@echo 跳过设置开机自启动
-		@goto SkipAutostartSet
+		@goto setAutoStartWithStartup
 	)
 )
 
+:setAutoStartWithRegist
 @echo 读取注册表信息,判断是否已经设置开机自启动,如果未设置或者之前设置为脚本自启动,修改为通过VTM.exe自启动
 @set regFile=%TEMP%\rvc_spshellautostart.reg
 @set regTmpFile=%cd%\rvckey.txt
@@ -207,7 +182,8 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 		@rem @set poweroffPC=2
 	)
 )
-
+@set AutoStartDir=C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
+@set AutoStartDir2=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
 @if %installType% equ 4 (
 	@if %explorerNormal% neq 1 (
 		@echo 取消可视柜台应用程序开机自启动(同时恢复桌面)
@@ -222,12 +198,53 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 		@del %regFile%
 		@rem @set poweroffPC=2
 	)
+	@echo 移除自启动文件
+	@echo AutoStartDir=%AutoStartDir%
+	@echo AutoStartDir2=%AutoStartDir2%
+	@if exist "%AutoStartDir%\%lnkPath%" (
+		@echo 移除自启动文件1
+		@del "%AutoStartDir%\%lnkPath%"
+	)
+	@if exist "%AutoStartDir2%\%lnkPath%" (
+		@echo 移除自启动文件2
+		@del "%AutoStartDir2%\%lnkPath%"
+	)
+	@goto End
 )
+@goto DoneAutostartSet
+
+:setAutoStartWithStartup
+
+@rem @echo 设置系统壁纸
+@rem @set WallpaperPath=D:\Temp\LR04.02_RVCTerminalPlus\addin\packaging\DEBIAN\WallPaper1920.png
+@rem reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %WallpaperPath% /f 
+@rem reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallpaperStyle /t REG_DWORD /d 2 /f 
+@rem RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
+@rem taskkill /f /im explorer.exe
+@rem cmd /c start explorer
+
+@set targetPath=%rvc_install_path_versions_dir%\vtm.exe
+
+@set curVersion=
+@set srcIconPath=%rvc_src_path_Run_dir%\version\%curVersion%\bin\VTM.ico
+@set aimIconPath=%rvc_install_path_rvc_res_dir%\VTM.ico
+@if exist %rvc_src_path_Run_dir%\version\active.txt (
+	for /f "delims=" %%a in (%rvc_src_path_Run_dir%\version\active.txt) do (
+		@set curVersion=%%a
+	)
+) else (
+	@echo [WARN] active.txt 不存在
+)
+@echo curVersion=%curVersion%
+mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startup"") & ""\%lnkPath%""):b.TargetPath=""%targetPath%"":b.WorkingDirectory=""%rvc_install_path_versions_dir%"":b.Description=""招行可视柜台终端应用"":b.Save:close")
+@rem ResourceWatcher:可视柜台.lnk
+@rem RVCTerminalApplication:招商银行可视柜台.lnk
+@rem :Set b1=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\%lnkPath%""):b1.TargetPath=""%targetPath%"":b1.WorkingDirectory=""%rvc_install_path_versions_dir%"":b1.Description=""招行可视柜台终端应用"":b1.Save:close
 
-@echo 结束设置可视柜台应用程序开机自启动策略
-:SkipAutostartSet
+:DoneAutostartSet
+@echo 【3/3】结束设置可视柜台应用程序开机自启动
 
-@echo 【5/5】 打开版本所在文件夹
+@echo 【4/4】 打开应用版本所在目录
 @start %rvc_install_path_versions_dir%
 
 @goto End
@@ -235,7 +252,6 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 @set ret=1
 
 :End
-
 @if "%ret%" == "1" (
 	@call :ColorText 4F "[ERROR] 安装失败,具体失败步骤见上方描述!!"
 ) else (

+ 64 - 71
addin/packaging/WIN/original.bat

@@ -56,7 +56,7 @@ echo [RVCTermianal] ========== Install Start ==========
 ) else (
 	@set rvc_install_path_root=C:
 )
-@set rvc_runtime_dir=%rvc_install_path_root%\VTMDepencies
+@set lnkPath=spexplorerauto.lnk
 @echo install type: %installType%
 
 tasklist /nh | find /i "spshell.exe"
@@ -104,57 +104,27 @@ tasklist /nh | find /i "spshell.exe"
 	)
 )
 
-@if not exist %rvc_install_path_rvc_dir% md %rvc_install_path_rvc_dir%
-@if not exist %rvc_install_path_rvc_res_dir% md %rvc_install_path_rvc_res_dir%
-@if not exist %rvc_install_path_Run_dir% md %rvc_install_path_Run_dir%
-@if not exist %rvc_install_path_hardware_dir% md %rvc_install_path_hardware_dir%
-@if not exist %rvc_install_path_versions_dir% md %rvc_install_path_versions_dir%
+@if %installType% equ 4 (
+	@if exist %rvc_install_path_Run_dir% rd /S /Q %rvc_install_path_Run_dir%
+	@if exist %rvc_install_path_rvc_dir% rd /S /Q %rvc_install_path_rvc_dir%
+	@goto setAutoStartWithRegist
+)
+
+@if not exist "%rvc_install_path_rvc_dir%" md "%rvc_install_path_rvc_dir%"
+@if not exist "%rvc_install_path_rvc_res_dir%" md "%rvc_install_path_rvc_res_dir%"
+@if not exist "%rvc_install_path_Run_dir%" md "%rvc_install_path_Run_dir%"
+@if not exist "%rvc_install_path_hardware_dir%" md "%rvc_install_path_hardware_dir%"
+@if not exist "%rvc_install_path_versions_dir%" md "%rvc_install_path_versions_dir%"
 
 @echo 【0/1】拷贝RVC目录...
 @xcopy %rvc_src_path_rvc_dir% %rvc_install_path_rvc_dir%  /E/Y/Q
 @echo 【1/1】拷贝RVC目录OK!
 
-
 @echo 【1/2】拷贝终端版本...
 @if exist %rvc_src_path_Run_dir%\hardwarecfg ( xcopy %rvc_src_path_Run_dir%\hardwarecfg %rvc_install_path_hardware_dir%  /E/Y/Q )
 @xcopy %rvc_src_path_Run_dir%\version %rvc_install_path_versions_dir%  /E/Y/Q
 @echo 【2/2】拷贝终端版本OK!
 
-@rem 不再分离出基础库文件
-@goto SkipInstallRuntime
-@echo 运行时基础文件存放路径 %rvc_runtime_dir%
-@if exist %rvc_runtime_dir% rd /S /Q %rvc_runtime_dir%
-if not exist "%rvc_runtime_dir%" md "%rvc_runtime_dir%"
-
-@echo 【2/3】拷贝基础运行时依赖文件...
-@xcopy %rvc_src_path_runbase_dir% %rvc_runtime_dir%  /E/Y/Q
-@echo 【3/3】拷贝基础运行时依赖文件OK!
-
-@echo 【3/4】设置系统环境变量...
-@set OldPath=%PATH%
-@set /a maxlen=1024
-@set /a num=0
-@set /a updateFlag=0
-@echo current path: %OldPath%
-@echo "%OldPath%" | findstr "%rvc_runtime_dir%" > nul && (
-	@echo [INFO]: 系统变量中已包含基础运行库文件目录路径
-) || (
-	@echo [INFO]: 系统变量中不包含基础运行库文件目录路径,开始设置...
-	@call :stringLenth "%OldPath%" num
-	@set updateFlag=1
-)
-@if %updateFlag% equ 1 (
-	@echo [DEBUG]: length: %num%
-	@if %num% geq 1024 (
-		@call :ColorText 4F "[ERROR] 已有的环境变量内容大于1024,无法通过程序更新系统环境PATH,请手工将值%rvc_runtime_dir%添加到PATH系统环境中,然后再运行此安装脚本"
-		@goto InstallError
-	)
-)
-
-@echo 【4/4】设置系统环境变量成功
-
-:SkipInstallRuntime
-
 @set FileCount=0
 @set desk_path=%USERPROFILE%\Desktop
 @echo desk_path=%desk_path%
@@ -166,35 +136,16 @@ if not exist "%rvc_runtime_dir%" md "%rvc_runtime_dir%"
 	@call :ColorText E0 "[WARN] 桌面不允许留存任何其他无关文件!"
 )
 
-@set targetPath=%rvc_install_path_versions_dir%\vtm.exe
-@set lnkPath=vtmlauncher.lnk
-@set curVersion=
-
-@if %installType% eq 0 (
-	@if exist %rvc_src_path_Run_dir%\version\active.txt (
-		for /f "delims=" %%a in (%rvc_src_path_Run_dir%\version\active.txt) do (
-			@set curVersion=%%a
-		)
-	)
-	@echo curVersion=%curVersion%
-	@if "%curVersion%" neq "" (
-		@echo 拷贝应用程序图标文件
-		@xcopy %rvc_src_path_Run_dir%\version\%curVersion%\bin\VTM.ico %rvc_install_path_rvc_res_dir%  /E/Y/Q
-	)
-	mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startup"") & ""\%lnkPath%.lnk""):b.TargetPath=""%targetPath%"":b.WorkingDirectory=""%rvc_install_path_versions_dir%"":b.IconLocation=""%rvc_install_path_rvc_res_dir%\VTM.ico, 0"":b.Description=""招行可视柜台终端应用"":b.Save:close")
+@echo 【2/3】设置可视柜台应用程序开机自启动
 
-	mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\招行可视柜台终端应用.lnk""):b.TargetPath=""%targetPath%"":b.WorkingDirectory=""%rvc_install_path_versions_dir%"":b.IconLocation=""%rvc_install_path_rvc_res_dir%\VTM.ico, 0"":b.Description=""招行可视柜台终端应用"":b.Save:close")
-	@echo 结束设置可视柜台应用程序开机自启动策略
-	@goto SkipAutostartSet
-) else (
-	@if %installType% neq 1 (
-		@if %installType% neq 4 (
-			@echo 跳过设置开机自启动
-			@goto SkipAutostartSet
-		)
+@echo installType=%installType%
+@if %installType% neq 1 (
+	@if %installType% neq 4 (
+		@goto setAutoStartWithStartup
 	)
 )
 
+:setAutoStartWithRegist
 @echo 读取注册表信息,判断是否已经设置开机自启动,如果未设置或者之前设置为脚本自启动,修改为通过VTM.exe自启动
 @set regFile=%TEMP%\rvc_spshellautostart.reg
 @set regTmpFile=%cd%\rvckey.txt
@@ -238,7 +189,8 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 		@rem @set poweroffPC=2
 	)
 )
-
+@set AutoStartDir=C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
+@set AutoStartDir2=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
 @if %installType% equ 4 (
 	@if %explorerNormal% neq 1 (
 		@echo 取消可视柜台应用程序开机自启动(同时恢复桌面)
@@ -253,12 +205,53 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 		@del %regFile%
 		@rem @set poweroffPC=2
 	)
+	@echo 移除自启动文件
+	@echo AutoStartDir=%AutoStartDir%
+	@echo AutoStartDir2=%AutoStartDir2%
+	@if exist "%AutoStartDir%\%lnkPath%" (
+		@echo 移除自启动文件1
+		@del "%AutoStartDir%\%lnkPath%"
+	)
+	@if exist "%AutoStartDir2%\%lnkPath%" (
+		@echo 移除自启动文件2
+		@del "%AutoStartDir2%\%lnkPath%"
+	)
+	@goto End
+)
+@goto DoneAutostartSet
+
+:setAutoStartWithStartup
+
+@rem @echo 设置系统壁纸
+@rem @set WallpaperPath=D:\Temp\LR04.02_RVCTerminalPlus\addin\packaging\DEBIAN\WallPaper1920.png
+@rem reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %WallpaperPath% /f 
+@rem reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallpaperStyle /t REG_DWORD /d 2 /f 
+@rem RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
+@rem taskkill /f /im explorer.exe
+@rem cmd /c start explorer
+
+@set targetPath=%rvc_install_path_versions_dir%\vtm.exe
+
+@set curVersion=
+@set srcIconPath=%rvc_src_path_Run_dir%\version\%curVersion%\bin\VTM.ico
+@set aimIconPath=%rvc_install_path_rvc_res_dir%\VTM.ico
+@if exist %rvc_src_path_Run_dir%\version\active.txt (
+	for /f "delims=" %%a in (%rvc_src_path_Run_dir%\version\active.txt) do (
+		@set curVersion=%%a
+	)
+) else (
+	@echo [WARN] active.txt 不存在
 )
+@echo curVersion=%curVersion%
+mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startup"") & ""\%lnkPath%""):b.TargetPath=""%targetPath%"":b.WorkingDirectory=""%rvc_install_path_versions_dir%"":b.Description=""招行可视柜台终端应用"":b.Save:close")
+@rem ResourceWatcher:可视柜台.lnk
+@rem RVCTerminalApplication:招商银行可视柜台.lnk
+@rem :Set b1=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\%lnkPath%""):b1.TargetPath=""%targetPath%"":b1.WorkingDirectory=""%rvc_install_path_versions_dir%"":b1.Description=""招行可视柜台终端应用"":b1.Save:close
 
-@echo 结束设置可视柜台应用程序开机自启动策略
-:SkipAutostartSet
+:DoneAutostartSet
+@echo 【3/3】结束设置可视柜台应用程序开机自启动
 
-@echo 【5/5】 打开版本所在文件夹
+@echo 【4/4】 打开应用版本所在目录
 @start %rvc_install_path_versions_dir%
 
 @goto End