Browse Source

#IQRV #comment [bugfix]安装脚本优化

80374374 1 year ago
parent
commit
15b3029414
2 changed files with 42 additions and 8 deletions
  1. 21 4
      addin/packaging/WIN/installbat.in
  2. 21 4
      addin/packaging/WIN/original.bat

+ 21 - 4
addin/packaging/WIN/installbat.in

@@ -118,14 +118,25 @@ tasklist /nh | find /i "spshell.exe"
 @echo 【2/3】设置系统桌面壁纸
 @set FileCount=0
 @set desk_path=%USERPROFILE%\Desktop
+@set desk_path_pub=C:\Users\Public\Desktop
 @echo desk_path=%desk_path%
 @if %installType% equ 1 (
 	@echo [WARN] 清理桌面文件内容
 	@for /d %%a in (%desk_path%\*) do (
-		@rd /S /Q %%a
+		@echo %%a
+		@rd /S /Q "%%a"
 	)
 	@for %%a in (%desk_path%\*) do (
-		@del %%a
+		@echo %%a
+		@del "%%a"
+	)
+	@for /d %%a in (%desk_path_pub%\*) do (
+		@echo %%a
+		@rd /S /Q "%%a"
+	)
+	@for %%a in (%desk_path_pub%\*) do (
+		@echo %%a
+		@del "%%a"
 	)
 	@echo [INFO] 清理桌面文件内容OK!
 ) else (
@@ -133,6 +144,10 @@ tasklist /nh | find /i "spshell.exe"
 		set /a FileCount+=1
 		@echo %%a
 	)
+	@for %%a in (%desk_path_pub%\*) do (
+		set /a FileCount+=1
+		@echo %%a
+	)
 	@if !FileCount! neq 0 (
 		@call :ColorText E0 "[WARN] 桌面存在文件数量:!FileCount!,不建议在桌面存留文件,生产版本将会清理桌面内容!"
 	)
@@ -154,13 +169,15 @@ tasklist /nh | find /i "spshell.exe"
 @if %installType% equ 1 (
 	@rem 生产版本设置壁纸
 	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 
-	RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters	
+	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 非生产环境不自动设置壁纸,避免影响开发人员的开发设备
+	@goto doNotRunUpdatePerEtc
 )
+RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
+:doNotRunUpdatePerEtc
 @echo 【3/3】设置系统桌面壁纸OK!
 
 

+ 21 - 4
addin/packaging/WIN/original.bat

@@ -125,14 +125,25 @@ tasklist /nh | find /i "spshell.exe"
 @echo 【2/3】设置系统桌面壁纸
 @set FileCount=0
 @set desk_path=%USERPROFILE%\Desktop
+@set desk_path_pub=C:\Users\Public\Desktop
 @echo desk_path=%desk_path%
 @if %installType% equ 1 (
 	@echo [WARN] 清理桌面文件内容
 	@for /d %%a in (%desk_path%\*) do (
-		@rd /S /Q %%a
+		@echo %%a
+		@rd /S /Q "%%a"
 	)
 	@for %%a in (%desk_path%\*) do (
-		@del %%a
+		@echo %%a
+		@del "%%a"
+	)
+	@for /d %%a in (%desk_path_pub%\*) do (
+		@echo %%a
+		@rd /S /Q "%%a"
+	)
+	@for %%a in (%desk_path_pub%\*) do (
+		@echo %%a
+		@del "%%a"
 	)
 	@echo [INFO] 清理桌面文件内容OK!
 ) else (
@@ -140,6 +151,10 @@ tasklist /nh | find /i "spshell.exe"
 		set /a FileCount+=1
 		@echo %%a
 	)
+	@for %%a in (%desk_path_pub%\*) do (
+		set /a FileCount+=1
+		@echo %%a
+	)
 	@if !FileCount! neq 0 (
 		@call :ColorText E0 "[WARN] 桌面存在文件数量:!FileCount!,不建议在桌面存留文件,生产版本将会清理桌面内容!"
 	)
@@ -161,13 +176,15 @@ tasklist /nh | find /i "spshell.exe"
 @if %installType% equ 1 (
 	@rem 生产版本设置壁纸
 	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 
-	RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters	
+	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 非生产环境不自动设置壁纸,避免影响开发人员的开发设备
+	@goto doNotRunUpdatePerEtc
 )
+RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
+:doNotRunUpdatePerEtc
 @echo 【3/3】设置系统桌面壁纸OK!