ソースを参照

#IQRV #comment 安装脚本迭代1

80374374 1 年間 前
コミット
182022fa9a
1 ファイル変更37 行追加28 行削除
  1. 37 28
      addin/packaging/WIN/original.bat

+ 37 - 28
addin/packaging/WIN/original.bat

@@ -91,8 +91,20 @@ tasklist /nh | find /i "spshell.exe"
 @echo rvc_install_path_hardware_dir=%rvc_install_path_hardware_dir%
 @echo rvc_install_path_versions_dir=%rvc_install_path_versions_dir%
 
+@set RVCTerminalDirName=
+@set RVCTerminalDirFullPath=
+@set RVCCurInstallVersion=
+@for /d %%a in (%rvc_src_path_Run_dir%\version\*) do (
+	@set RVCTerminalDirFullPath=%%a
+	@set RVCTerminalDirName=%%~nxa
+	@goto GetRVCTerminalDirNameDone
+)
+:GetRVCTerminalDirNameDone
+@set RVCCurInstallVersion=%RVCTerminalDirName%
+@echo RVCCurInstallVersion=%RVCCurInstallVersion%
+
 @if exist %rvc_install_path_hardware_dir%\root.ini (
-	@echo 存在root.ini文件,跳过版本清理操作
+	@echo [WARN] 存在root.ini文件,认为是存量安装,跳过版本清理操作
 ) else (
 	@if exist %rvc_install_path_versions_dir% (
 		@echo 移除旧有应用版本文件
@@ -166,11 +178,11 @@ tasklist /nh | find /i "spshell.exe"
 ) else (
 	@for %%a in (%desk_path%\*) do (
 		set /a FileCount+=1
-		@echo %%a
+		@echo [DEBUG] %%a
 	)
 	@for %%a in (%desk_path_pub%\*) do (
 		set /a FileCount+=1
-		@echo %%a
+		@echo [DEBUG] %%a
 	)
 	@if !FileCount! neq 0 (
 		@call :ColorText E0 "[WARN] 桌面存在文件数量:!FileCount!,不建议在桌面存留文件,生产版本将会清理桌面内容!"
@@ -178,6 +190,7 @@ tasklist /nh | find /i "spshell.exe"
 )
 
 @set WallpaperPath=%rvc_install_path_rvc_res_dir%\WallPaper1920.png
+@set WallpaperPath2=%rvc_install_path_rvc_res_dir%\WallPaper1280.png
 @if not exist C:\Windows\Web\Wallpaper\WallPaper1920.png (
 	@if exist "C:\Windows\Web\Wallpaper" (
 		@copy %WallpaperPath% C:\Windows\Web\Wallpaper
@@ -185,22 +198,22 @@ tasklist /nh | find /i "spshell.exe"
 		@set WallpaperPath=C:\Windows\Web\Wallpaper\WallPaper1920.png
 	)
 ) else (
-	@echo 指定壁纸已存在系统目录
+	@echo [DEBUG] 指定壁纸已存在系统目录
 	@set WallpaperPath=C:\Windows\Web\Wallpaper\WallPaper1920.png
 )
 @echo WallpaperPath=%WallpaperPath%
 @if %installType% equ 1 (
-	@rem 生产版本设置壁纸
+	@echo 通过注册表设置桌面壁纸
 	reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %WallpaperPath% /f 
 	reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallpaperStyle /t REG_DWORD /d 2 /f
 	@rem taskkill /f /im explorer.exe
 	@rem cmd /c start explorer
 ) else (
-	@echo 非生产环境不自动设置壁纸,避免影响开发人员的开发设备
+	@call :ColorText E0 "[WARN] 非生产环境不自动设置壁纸,避免影响开发人员的开发设备"
 	@goto doNotRunUpdatePerEtc
 )
 
-@echo 隐藏工具栏
+@echo [INFO] 隐藏工具栏
 @rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3" /v Settings /t REG_BINARY /d 01000000000000000000000000000000 /f
 @rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 2 /f
 @rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideTaskbar /t REG_DWORD /d 1 /f
@@ -209,11 +222,11 @@ tasklist /nh | find /i "spshell.exe"
 @rem mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):a.Run""taskbar.exe /hide"",0,False:close")
 
 powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=2;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
+RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
 
 @rem 将任务栏自动隐藏选项切换为关闭
 @rem powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=2;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
 
-RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
 :doNotRunUpdatePerEtc
 @echo 【3/3】设置系统桌面壁纸OK!
 
@@ -304,18 +317,15 @@ regedit /e %regFile% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVe
 	@echo %%i
 	@del "%%i"
 )
-@set targetPath=%rvc_install_path_versions_dir%\vtm.exe
-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:Set b1=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\可视柜台.lnk""):b1.TargetPath=""%targetPath%"":b1.WorkingDirectory=""%rvc_install_path_versions_dir%"":b1.Description=""招行可视柜台终端应用"":b1.Save:close")
+@echo [INFO] 设置应用自启动和桌面图标
 @rem ResourceWatcher:可视柜台.lnk
 @rem RVCTerminalApplication:招商银行可视柜台.lnk
+@set targetPath=%rvc_install_path_versions_dir%\vtm.exe
+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:Set b1=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\可视柜台.lnk""):b1.TargetPath=""%targetPath%"":b1.WorkingDirectory=""%rvc_install_path_versions_dir%"":b1.Description=""招行可视柜台终端应用"":b1.Save:close")
 
 :DoneAutostartSet
 @echo 【4/4】设置可视柜台应用程序开机自启动OK! 
 
-@echo 【5/5】显示桌面
-@rem 显示桌面 MinimizeAll ToggleDesktop
-mshta VBScript:Execute("Set a=CreateObject(""Shell.Application""):a.MinimizeAll:close")
-
 @rem @echo 【5/5】打开应用版本所在目录
 @rem @start %rvc_install_path_versions_dir%
 
@@ -326,22 +336,21 @@ mshta VBScript:Execute("Set a=CreateObject(""Shell.Application""):a.MinimizeAll:
 :End
 @if "%ret%" == "1" (
 	@call :ColorText 4F "[ERROR] 安装失败,具体失败步骤见上方描述!!"
-) else (
-	@if %poweroffPC% equ 2 ( echo [INFO]: 5s 后自动重启设备 )
-	@if %poweroffPC% equ 1 ( echo [INFO]: 5s 后自动关机 )
-	@if %poweroffPC% equ 0 ( 
-		@call :ColorText 2F "[INFO] ===所有安装步骤执行成功,正常退出==="
-		@echo [INFO]: 5s 后自动退出该执行脚本
-	)
-	@for /l %%a in (1, 1, 5) do (
-			timeout 1 > nul
-			@echo [DEBUG]: %%a秒……
-		)
-	@if %poweroffPC% equ 2 ( shutdown /r /t 0 )
-	@if %poweroffPC% equ 1 ( shutdown /s /t 0 )
-	
+	@pause
+	@goto Done
 )
 
+@call :ColorText 2F "[INFO] ===所有安装步骤执行成功,正常退出,可视柜台版本号:%RVCCurInstallVersion%==="
+@echo [INFO]: 5s 后自动退出该执行脚本并展示桌面
+@for /l %%a in (1, 1, 5) do (
+		timeout 1 > nul
+		@echo [DEBUG]: %%a秒……
+	)
+@echo 显示桌面
+@rem MinimizeAll ToggleDesktop	
+mshta VBScript:Execute("Set a=CreateObject(""Shell.Application""):a.MinimizeAll:close")
+
+:Done
 @exit %ret%
 
 :stringLenth