|
@@ -0,0 +1,440 @@
|
|
|
+@echo off
|
|
|
+@setlocal enabledelayedexpansion
|
|
|
+@set CurrentDir=%~dp0
|
|
|
+@cd /d %CurrentDir%
|
|
|
+@set ROOT=%cd%
|
|
|
+@set ret=-1
|
|
|
+@set errmsg=all process has been executed succ
|
|
|
+@set resultFile=%CurrentDir%result.log
|
|
|
+@set tmpLogFile=D:\\test.txt
|
|
|
+@set supportBS=1
|
|
|
+@echo result=-1^&msg=install begin >%resultFile%
|
|
|
+@echo [RVCTermianal] ========== Install Start ==========
|
|
|
+@echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
|
|
|
+@echo Current Dir: %CurrentDir%
|
|
|
+@echo ROOT Dir: %ROOT%
|
|
|
+::rem get os bit
|
|
|
+reg query HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 /v "Identifier" | find "64 Family" >NUL 2>nul && set OS=64BIT || set OS=32BIT
|
|
|
+if %OS%==32BIT (
|
|
|
+ @echo [DEBUg] x86 platform
|
|
|
+) else (
|
|
|
+ @echo [DEBUg] x64 platform
|
|
|
+)
|
|
|
+@Set RunVersionPath=
|
|
|
+@rem 0:explorer.exe
|
|
|
+@rem 1:vbs
|
|
|
+@rem 2:vtm.exe
|
|
|
+@rem 3:startmenu lnk from RVCTermimalApplicationSetup
|
|
|
+@rem 4:startmenu lnk from install scripts
|
|
|
+@rem 404:unknown
|
|
|
+@Set CurAutoStartType=404
|
|
|
+@set NewAutoStartLnkName=spexplorerauto.lnk
|
|
|
+
|
|
|
+@rem 获取当前的rvc目录
|
|
|
+@Set RVCPath=
|
|
|
+@Set RVCResourcePath=
|
|
|
+@for %%a in ("%~dp0.") do for %%b in ("%%~dpa.") do set RVCPath=%%~dpb
|
|
|
+
|
|
|
+
|
|
|
+@rem 获取Resources的目录
|
|
|
+@set testRVCPath=%RVCPath%
|
|
|
+@echo testRVCPath=%testRVCPath%
|
|
|
+@for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set testRVCPath=%%testRVCPath:%%i=%%i%%
|
|
|
+@echo %testRVCPath% | findstr "rvc\\" >nul && (
|
|
|
+ @Set RVCResourcePath=%RVCPath%Resources
|
|
|
+)
|
|
|
+@echo RVCResourcePath=%RVCResourcePath%
|
|
|
+@if "%RVCResourcePath%" == "" (
|
|
|
+ @set errmsg=cannot found rvc path[%RVCPath%]
|
|
|
+ @set ret=-10
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+@if not exist "%RVCResourcePath%" md "%RVCResourcePath%"
|
|
|
+@set DestAppIconPath=%RVCResourcePath%\VTM.ico
|
|
|
+@set SrcAppIconPath=%ROOT%\VTM.ico
|
|
|
+@if not exist "%DestAppIconPath%" (
|
|
|
+ @if not exist "%SrcAppIconPath%" (
|
|
|
+ @set errmsg=%SrcAppIconPath% does not exist
|
|
|
+ @set ret=-4
|
|
|
+ @goto UserError
|
|
|
+ )
|
|
|
+ @copy "%SrcAppIconPath%" %DestAppIconPath%
|
|
|
+)
|
|
|
+
|
|
|
+@rem 设置桌面壁纸
|
|
|
+:SetWallpaper
|
|
|
+@echo result=-1^&msg=set wallpaper >%resultFile%
|
|
|
+@set RVCWallpaperName=WallPaper1920.png
|
|
|
+@set regKey=HKEY_CURRENT_USER\Control Panel\Desktop
|
|
|
+@set regValue=Wallpaper
|
|
|
+@set regData=
|
|
|
+for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+)
|
|
|
+@echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@if "%regData%" == "" (
|
|
|
+ set supportBS=0
|
|
|
+ echo [DEBUG] to get Wallpaper twice
|
|
|
+ for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+ )
|
|
|
+)
|
|
|
+echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@if "%regData%" == "" (
|
|
|
+ @set errmsg=cannot found Wallpaper value
|
|
|
+ @set ret=-5
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+@set WallpaperRegVal=%regData%
|
|
|
+@echo %regData% | findstr "%RVCWallpaperName%" >nul && (
|
|
|
+ @if exist %WallpaperRegVal% (
|
|
|
+ @echo [DEBUG] Wallpaper has been set before
|
|
|
+ @set errmsg=Wallpaper has been set before
|
|
|
+ @goto ClearSysDesktopIcon
|
|
|
+ )
|
|
|
+)
|
|
|
+@set WallpaperPath=%ROOT%\%RVCWallpaperName%
|
|
|
+@set backupWallPaperPath=%ROOT%\\%RVCWallpaperName%
|
|
|
+@if not exist "%WallpaperPath%" (
|
|
|
+ @Set errmsg=%WallpaperPath% does not exist
|
|
|
+ @set ret=-6
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+@if not exist C:\Windows\Web\Wallpaper\%RVCWallpaperName% (
|
|
|
+ @if exist "C:\Windows\Web\Wallpaper" (
|
|
|
+ @copy "%WallpaperPath%" C:\Windows\Web\Wallpaper
|
|
|
+ @set WallpaperPath=C:\Windows\Web\Wallpaper\%RVCWallpaperName%
|
|
|
+ @set backupWallPaperPath=C:\\Windows\\Web\\Wallpaper\\%RVCWallpaperName%
|
|
|
+ ) else (
|
|
|
+ @copy "%WallpaperPath%" %RVCResourcePath%
|
|
|
+ @set WallpaperPath=%RVCResourcePath%\%RVCWallpaperName%
|
|
|
+ @set backupWallPaperPath=%RVCResourcePath%\\%RVCWallpaperName%
|
|
|
+ )
|
|
|
+) else (
|
|
|
+ @set WallpaperPath=C:\Windows\Web\Wallpaper\%RVCWallpaperName%
|
|
|
+ @set backupWallPaperPath=C:\\Windows\\Web\\Wallpaper\\%RVCWallpaperName%
|
|
|
+)
|
|
|
+
|
|
|
+@echo [DEBUG] WallpaperPath=%WallpaperPath%
|
|
|
+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
|
|
|
+@if %errorlevel% neq 0 (
|
|
|
+ echo add for Desktop first failed
|
|
|
+ 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
|
|
|
+ @if !errorlevel! neq 0 (
|
|
|
+ @set errmsg=Set Wallpaper failed
|
|
|
+ @set ret=-11
|
|
|
+ @goto UserError
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+@rem 清理桌面系统图标
|
|
|
+:ClearSysDesktopIcon
|
|
|
+@set errmsg=to clear desktop system icon
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {645FF040-5081-101B-9F08-00AA002F954E} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {645FF040-5081-101B-9F08-00AA002F954E} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 1 /f
|
|
|
+reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 1 /f
|
|
|
+
|
|
|
+
|
|
|
+:getCurStartType
|
|
|
+@set errmsg=to get current start type
|
|
|
+@set AutoStartDir=C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
|
|
|
+@set AutoStartDirPublic=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
|
|
|
+@set regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
|
|
|
+@set regValue=Shell
|
|
|
+@set regData=
|
|
|
+for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+)
|
|
|
+echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@if "%regData%" == "" (
|
|
|
+ echo [DEBUG] to get Shell twice
|
|
|
+ for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+ )
|
|
|
+)
|
|
|
+echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@set explorerKey=%regData%
|
|
|
+@if "%explorerKey%" == "" (
|
|
|
+ @echo Get Shell value is Empty
|
|
|
+ @goto EmptyShellVal
|
|
|
+)
|
|
|
+
|
|
|
+@for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set explorerKey=%%explorerKey:%%i=%%i%%
|
|
|
+@echo [DEBUG] explorer key:%explorerKey%
|
|
|
+@if "%explorerKey%" == "explorer.exe" (
|
|
|
+ @Set CurAutoStartType=0
|
|
|
+) else if "%explorerKey%" == "d:\run\version\vtm.exe" (
|
|
|
+ @rem TODO 要考虑生产上的这些值的具体内容
|
|
|
+ @echo [INFO] 检测到已设置为VTM.exe开机自启动模式
|
|
|
+ @Set CurAutoStartType=2
|
|
|
+ @rem 直接获取到VTM.exe的路径
|
|
|
+ @set RunVersionPath=d:\run\version\
|
|
|
+) else if "%explorerKey%" == "wscript d:\run\version\spexplorerfast.vbs" (
|
|
|
+ @rem TODO 要考虑生产上的这些值的具体内容
|
|
|
+ @echo [INFO] 检测到已设置为VBS脚本开机自启动模式
|
|
|
+ @Set CurAutoStartType=1
|
|
|
+ @rem 直接获取到VTM.exe的路径
|
|
|
+ @set RunVersionPath=d:\run\version\
|
|
|
+)
|
|
|
+
|
|
|
+@if %CurAutoStartType% equ 0 (
|
|
|
+ @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
|
|
|
+ @Set CurAutoStartType=3
|
|
|
+ @echo [INFO] 检测到设置为开始菜单自启动模式
|
|
|
+ )
|
|
|
+ @rem 最新安装方式,这种情况不用处理
|
|
|
+ @if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
|
|
|
+ @Set CurAutoStartType=4
|
|
|
+ @echo [INFO] 检测到设置为安装脚本设置的开始菜单自启动模式
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+@rem d:\vtm\run-4.9.4.0\run\version\vtm.exe
|
|
|
+@rem e:\run\version\vtm.exe
|
|
|
+@rem c:\run\version\vtm.exe
|
|
|
+@rem d:run\version\vtm.exe
|
|
|
+@if %CurAutoStartType% equ 404 (
|
|
|
+ @echo %explorerKey% | findstr "vtm.exe" >nul && (
|
|
|
+ @echo [INFO] 检测到已设置为VTM.exe开机自启动模式
|
|
|
+ @Set CurAutoStartType=2
|
|
|
+ )
|
|
|
+ @echo %explorerKey% | findstr ".vbs" >nul && (
|
|
|
+ @echo %explorerKey% | findstr "wscript" >nul && (
|
|
|
+ @echo [INFO] 检测到已设置为VBS脚本开机自启动模式
|
|
|
+ @Set CurAutoStartType=1
|
|
|
+ )
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+:EmptyShellVal
|
|
|
+
|
|
|
+@rem 检测不到的情况下,这里也做下兼容
|
|
|
+@if %CurAutoStartType% equ 404 (
|
|
|
+ @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
|
|
|
+ @Set CurAutoStartType=3
|
|
|
+ @echo [DEBUG] 检测到设置为开始菜单自启动模式
|
|
|
+ )
|
|
|
+ @rem 最新安装方式,这种情况不用处理
|
|
|
+ @if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
|
|
|
+ @Set CurAutoStartType=4
|
|
|
+ @echo [DEBUG] 检测到设置为安装脚本设置的开始菜单自启动模式
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+@if %CurAutoStartType% equ 0 (
|
|
|
+ @echo [DEBUG] 检测到未设置为开机自启动模式
|
|
|
+)
|
|
|
+@echo CurAutoStartType=%CurAutoStartType%
|
|
|
+
|
|
|
+@rem 设置桌面图标
|
|
|
+: setDesktopIcon
|
|
|
+
|
|
|
+@echo result=-1^&msg=set app desktop icon >%resultFile%
|
|
|
+@set errmsg=set app desktop icon
|
|
|
+@if not "%RunVersionPath%" == "" (
|
|
|
+ @if exist "%RunVersionPath%" (
|
|
|
+ if exist "%RunVersionPath%vtm.exe" (
|
|
|
+ @echo version path got previously
|
|
|
+ @goto SkipGetRunVersionPath
|
|
|
+ )
|
|
|
+ )
|
|
|
+)
|
|
|
+@echo [DEBUG] to get version path from syspath
|
|
|
+@set SYSPATH=%Path%
|
|
|
+@set VendorPath=%RVC_VENDOR_HOME%
|
|
|
+@rem 拆分环境变量获取Run/version目录
|
|
|
+@set manuSysPath=%SYSPATH%
|
|
|
+@for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set manuSysPath=%%manuSysPath:%%i=%%i%%
|
|
|
+@echo path=%manuSysPath%
|
|
|
+@rem Mark1
|
|
|
+@set prefixPath=
|
|
|
+@set tofind=run\version
|
|
|
+@set aimStr=version
|
|
|
+@set aimLen=7
|
|
|
+@set foundstr=
|
|
|
+
|
|
|
+:loop
|
|
|
+::从环境变量中得到版本的路径
|
|
|
+@for /f "tokens=1* delims=;" %%a in ("%manuSysPath%") do (
|
|
|
+ @set str=%%a
|
|
|
+ @echo !str! | findstr "%tofind%" >nul && (
|
|
|
+ @set foundstr=!str!
|
|
|
+ @goto foundit
|
|
|
+ )
|
|
|
+ @set manuSysPath=%%b
|
|
|
+)
|
|
|
+if defined manuSysPath goto :loop
|
|
|
+if "%foundstr%" == "" (
|
|
|
+ @set errmsg=cannot fetch Run path from Env::path
|
|
|
+ @set ret=-7
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+:foundit
|
|
|
+@rem 从全路径里头获取version结尾
|
|
|
+@echo foundstr=%foundstr%
|
|
|
+@set fulStr=%foundstr%
|
|
|
+
|
|
|
+:next
|
|
|
+if not "%fulStr%" == "" (
|
|
|
+ @set /a num+=1
|
|
|
+ if "!fulStr:~0,%aimLen%!" == "%aimStr%" goto subfoundit
|
|
|
+ @set fulStr=%fulStr:~1%
|
|
|
+ goto next
|
|
|
+)
|
|
|
+@set /a num=0
|
|
|
+
|
|
|
+:subfoundit
|
|
|
+@echo num=%num%
|
|
|
+@set /a realnum=%aimLen%+%num%
|
|
|
+@if %num% neq 0 (
|
|
|
+ @set prefixPath=!foundstr:~0,%realnum%!
|
|
|
+)
|
|
|
+@echo prefixPath=%prefixPath%
|
|
|
+@if "prefixPath" == "" (
|
|
|
+ @set errmsg=cannot get run version path
|
|
|
+ @set ret=-8
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+@set RunVersionPath=%prefixPath%
|
|
|
+@echo RunVersionPath=%RunVersionPath%
|
|
|
+:SkipGetRunVersionPath
|
|
|
+@rem 得到vtm.exe全路径
|
|
|
+@set vtmfulPath=%RunVersionPath%vtm.exe
|
|
|
+@echo vtm exe full path is %vtmfulPath%
|
|
|
+@if not exist "%vtmfulPath%" (
|
|
|
+ @echo [ERROR] %vtmfulPath% does not exist
|
|
|
+ @set errmsg=%vtmfulPath% does not exist
|
|
|
+ @set ret=-9
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+
|
|
|
+@set desk_path=%USERPROFILE%\Desktop
|
|
|
+@set desk_path_pub=C:\Users\Public\Desktop
|
|
|
+@for %%a in (%desk_path%\*) do echo [DEBUG] desktop file: "%%a"
|
|
|
+@for %%a in (%desk_path_pub%\*) do echo [DEBUG] public desktop file: "%%a"
|
|
|
+@echo to clear desktop file
|
|
|
+@for /d %%a in (%desk_path%\*) do rd /S /Q "%%a"
|
|
|
+@for /d %%a in (%desk_path_pub%\*) do rd /S /Q "%%a"
|
|
|
+@for %%a in (%desk_path%\*) do del "%%a"
|
|
|
+@for %%a in (%desk_path_pub%\*) do del "%%a"
|
|
|
+
|
|
|
+mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b1=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\可视柜台.lnk""):b1.TargetPath=""%vtmfulPath%"":b1.WorkingDirectory=""%RunVersionPath%"":b1.Description=""招行可视柜台终端应用"":b1.Save:close")
|
|
|
+@if exist "%desk_path%\可视柜台.lnk" (
|
|
|
+ @echo [DEBUG] deskop icon is exist
|
|
|
+)
|
|
|
+
|
|
|
+@echo [DEBUG] set deskop app icon done
|
|
|
+@set errmsg=set deskop app icon done
|
|
|
+
|
|
|
+@rem 设置自启动
|
|
|
+@if %CurAutoStartType% equ 404 (
|
|
|
+ @echo [WARN] unknown set auto start and skip
|
|
|
+ @set ret=-2
|
|
|
+ @Set errmsg=unknown set auto start and skip
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+@if %CurAutoStartType% equ 0 (
|
|
|
+ @echo [WARN] no set auto start and skip
|
|
|
+ @Set errmsg=no set auto start and skip
|
|
|
+ @goto Done
|
|
|
+)
|
|
|
+@if %CurAutoStartType% equ 4 (
|
|
|
+ @echo [WARN] auto start by new install and skip
|
|
|
+ @Set errmsg=auto start by new install and skip
|
|
|
+ @goto Done
|
|
|
+)
|
|
|
+@if %CurAutoStartType% equ 1 (
|
|
|
+ @goto ResetRegeditExplorer
|
|
|
+)
|
|
|
+@if %CurAutoStartType% equ 2 (
|
|
|
+ @goto ResetRegeditExplorer
|
|
|
+)
|
|
|
+
|
|
|
+@if %CurAutoStartType% equ 3 (
|
|
|
+ @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
|
|
|
+ @del "%AutoStartDirPublic%\招商银行可视柜台.lnk"
|
|
|
+ )
|
|
|
+ @if not exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
|
|
|
+ @goto setAutoStartFromStartMenu
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+:ResetRegeditExplorer
|
|
|
+@echo [DEBUG] to reset regedit HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
|
|
|
+@set regFile=%TEMP%\rvc_exploreset.reg
|
|
|
+@del %regFile% > nul 2>&1
|
|
|
+@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Shell" /t REG_SZ /d "explorer.exe" /f
|
|
|
+@if %errorlevel% neq 0 (
|
|
|
+ echo [WARN] add for Winlogon twice
|
|
|
+ @reg add "\"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"" /v "Shell" /t REG_SZ /d "explorer.exe" /f
|
|
|
+ @if !errorlevel! neq 0 (
|
|
|
+ @echo [WARN] add for Winlogon third !errorlevel!
|
|
|
+ @echo Windows Registry Editor Version 5.00 > %regFile%
|
|
|
+ @echo. >> %regFile%
|
|
|
+ @echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >> %regFile%
|
|
|
+ @echo "Shell"="explorer.exe" >> %regFile%
|
|
|
+ regedit /s %regFile%
|
|
|
+ @del %regFile% > nul 2>&1
|
|
|
+ )
|
|
|
+)
|
|
|
+@set regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
|
|
|
+@set regValue=Shell
|
|
|
+@set regData=
|
|
|
+for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+)
|
|
|
+echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@if "%regData%" == "" (
|
|
|
+ echo [DEBUG] to get Shell twice
|
|
|
+ for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
|
|
|
+ set regData=%%b
|
|
|
+ )
|
|
|
+)
|
|
|
+echo [DEBUG] The value of %regValue% is: %regData%
|
|
|
+@set explorerKey=%regData%
|
|
|
+@for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set explorerKey=%%explorerKey:%%i=%%i%%
|
|
|
+@echo [DEBUG] explorer key:%explorerKey%
|
|
|
+@if "%explorerKey%" == "explorer.exe" (
|
|
|
+ @echo [DEBUG] reset explorer.exe done
|
|
|
+) else (
|
|
|
+ @echo [WARN] reset explorer.exe failed
|
|
|
+ @set ret=-3
|
|
|
+ @Set errmsg=reset explorer.exe failed
|
|
|
+ @goto UserError
|
|
|
+)
|
|
|
+
|
|
|
+:setAutoStartFromStartMenu
|
|
|
+@echo [DEBUG] to create startup
|
|
|
+mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""startup"") & ""\%NewAutoStartLnkName%""):b.TargetPath=""%vtmfulPath%"":b.WorkingDirectory=""%RunVersionPath%"":b.Description=""招行可视柜台终端应用"":b.Save:close")
|
|
|
+@if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
|
|
|
+ @echo [DEBUG] auto startup app icon is exist
|
|
|
+)
|
|
|
+@echo to create startup done
|
|
|
+
|
|
|
+@set errmsg=all process has been executed succ
|
|
|
+
|
|
|
+:Done
|
|
|
+@set ret=0
|
|
|
+@echo all process has been executed done
|
|
|
+@goto End
|
|
|
+
|
|
|
+:Error
|
|
|
+@set ret=-1
|
|
|
+
|
|
|
+:UserError
|
|
|
+@echo [Error] %errmsg%
|
|
|
+
|
|
|
+:End
|
|
|
+@echo result=%ret%^&msg=%errmsg% >%resultFile%
|
|
|
+@echo result=%ret%^&msg=%errmsg%
|
|
|
+@echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
|
|
|
+@exit 0
|