settings.bat 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. @echo off
  2. @setlocal enabledelayedexpansion
  3. @set CurrentDir=%~dp0
  4. @cd /d %CurrentDir%
  5. @set ROOT=%cd%
  6. @set ret=-1
  7. @set errmsg=all process has been executed succ
  8. @set resultFile=%CurrentDir%result.log
  9. @set tmpLogFile=D:\\test.txt
  10. @set supportBS=1
  11. @echo result=-1^&msg=install begin >%resultFile%
  12. @echo [RVCTermianal] ========== Install Start ==========
  13. @echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
  14. @echo Current Dir: %CurrentDir%
  15. @echo ROOT Dir: %ROOT%
  16. ::rem get os bit
  17. reg query HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 /v "Identifier" | find "64 Family" >NUL 2>nul && set OS=64BIT || set OS=32BIT
  18. if %OS%==32BIT (
  19. @echo [DEBUg] x86 platform
  20. ) else (
  21. @echo [DEBUg] x64 platform
  22. )
  23. @rem 操作系统版本
  24. @rem 10: Win10
  25. @rem 8: Win8
  26. @set SystermVer=0
  27. @set regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
  28. @set regValue=ProductName
  29. @set regData=
  30. for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  31. set regData=%%b
  32. )
  33. @echo [DEBUG] The value of %regValue% is: %regData%
  34. @if "%regData%" == "" (
  35. set supportBS=0
  36. echo [DEBUG] to get ProductName twice
  37. for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  38. set regData=%%b
  39. )
  40. )
  41. echo [DEBUG] The value of %regValue% is: %regData%
  42. @if "%regData%" == "" (
  43. @echo cannot found ProductName
  44. ) else (
  45. @echo %regData% | findstr "8.1" >nul && (
  46. @set SystermVer=8
  47. )
  48. @echo %regData% | findstr "10" >nul && (
  49. @set SystermVer=10
  50. )
  51. )
  52. echo [DEBUG] Windows Version: %SystermVer%
  53. @Set RunVersionPath=
  54. @rem 0:explorer.exe
  55. @rem 1:vbs
  56. @rem 2:vtm.exe
  57. @rem 3:startmenu lnk from RVCTermimalApplicationSetup
  58. @rem 4:startmenu lnk from install scripts
  59. @rem 404:unknown
  60. @Set CurAutoStartType=404
  61. @set NewAutoStartLnkName=spexplorerauto.lnk
  62. @rem 获取当前的rvc目录
  63. @Set RVCPath=
  64. @Set RVCResourcePath=
  65. @for %%a in ("%~dp0.") do for %%b in ("%%~dpa.") do set RVCPath=%%~dpb
  66. @rem 获取Resources的目录
  67. @set testRVCPath=%RVCPath%
  68. @echo testRVCPath=%testRVCPath%
  69. @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%%
  70. @echo %testRVCPath% | findstr "rvc\\" >nul && (
  71. @Set RVCResourcePath=%RVCPath%Resources
  72. )
  73. @echo RVCResourcePath=%RVCResourcePath%
  74. @if "%RVCResourcePath%" == "" (
  75. @set errmsg=cannot found rvc path[%RVCPath%]
  76. @set ret=-10
  77. @goto UserError
  78. )
  79. @if not exist "%RVCResourcePath%" md "%RVCResourcePath%"
  80. @set DestAppIconPath=%RVCResourcePath%\VTM.ico
  81. @set SrcAppIconPath=%ROOT%\VTM.ico
  82. @if not exist "%DestAppIconPath%" (
  83. @if not exist "%SrcAppIconPath%" (
  84. @set errmsg=%SrcAppIconPath% does not exist
  85. @set ret=-4
  86. @goto UserError
  87. )
  88. @copy "%SrcAppIconPath%" %DestAppIconPath%
  89. )
  90. @rem 设置桌面壁纸
  91. :SetWallpaper
  92. @echo result=-1^&msg=set wallpaper >%resultFile%
  93. @set RVCWallpaperName=WallPaper1920.png
  94. @set regKey=HKEY_CURRENT_USER\Control Panel\Desktop
  95. @set regValue=Wallpaper
  96. @set regData=
  97. for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  98. set regData=%%b
  99. )
  100. @echo [DEBUG] The value of %regValue% is: %regData%
  101. @if "%regData%" == "" (
  102. echo [DEBUG] to get Wallpaper twice
  103. for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  104. set regData=%%b
  105. )
  106. )
  107. echo [DEBUG] The value of %regValue% is: %regData%
  108. @if "%regData%" == "" (
  109. @set errmsg=cannot found Wallpaper value
  110. @set ret=-5
  111. @goto UserError
  112. )
  113. @set WallpaperRegVal=%regData%
  114. @echo %regData% | findstr "%RVCWallpaperName%" >nul && (
  115. @if exist %WallpaperRegVal% (
  116. @echo [DEBUG] Wallpaper has been set before
  117. @set errmsg=Wallpaper has been set before
  118. @goto ClearSysDesktopIcon
  119. )
  120. )
  121. @set WallpaperPath=%ROOT%\%RVCWallpaperName%
  122. @set backupWallPaperPath=%ROOT%\\%RVCWallpaperName%
  123. @if not exist "%WallpaperPath%" (
  124. @Set errmsg=%WallpaperPath% does not exist
  125. @set ret=-6
  126. @goto UserError
  127. )
  128. @if not exist C:\Windows\Web\Wallpaper\%RVCWallpaperName% (
  129. @if exist "C:\Windows\Web\Wallpaper" (
  130. @copy "%WallpaperPath%" C:\Windows\Web\Wallpaper
  131. @set WallpaperPath=C:\Windows\Web\Wallpaper\%RVCWallpaperName%
  132. @set backupWallPaperPath=C:\\Windows\\Web\\Wallpaper\\%RVCWallpaperName%
  133. ) else (
  134. @copy "%WallpaperPath%" %RVCResourcePath%
  135. @set WallpaperPath=%RVCResourcePath%\%RVCWallpaperName%
  136. @set backupWallPaperPath=%RVCResourcePath%\\%RVCWallpaperName%
  137. )
  138. ) else (
  139. @set WallpaperPath=C:\Windows\Web\Wallpaper\%RVCWallpaperName%
  140. @set backupWallPaperPath=C:\\Windows\\Web\\Wallpaper\\%RVCWallpaperName%
  141. )
  142. @echo [DEBUG] WallpaperPath=%WallpaperPath%
  143. reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "%WallpaperPath%" /f
  144. reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallpaperStyle /t REG_DWORD /d 2 /f
  145. @if %errorlevel% neq 0 (
  146. echo add for Desktop first failed
  147. reg add "\"HKEY_CURRENT_USER\Control Panel\Desktop\"" /v Wallpaper /t REG_SZ /d "%WallpaperPath%" /f
  148. reg add "\"HKEY_CURRENT_USER\Control Panel\Desktop\"" /v WallpaperStyle /t REG_DWORD /d 2 /f
  149. @if !errorlevel! neq 0 (
  150. @set errmsg=Set Wallpaper failed
  151. @set ret=-11
  152. @goto UserError
  153. )
  154. )
  155. @rem 清理桌面系统图标
  156. :ClearSysDesktopIcon
  157. @set errmsg=to clear desktop system icon
  158. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 1 /f
  159. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 1 /f
  160. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {645FF040-5081-101B-9F08-00AA002F954E} /t REG_DWORD /d 1 /f
  161. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {645FF040-5081-101B-9F08-00AA002F954E} /t REG_DWORD /d 1 /f
  162. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /t REG_DWORD /d 1 /f
  163. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /t REG_DWORD /d 1 /f
  164. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /t REG_DWORD /d 1 /f
  165. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /t REG_DWORD /d 1 /f
  166. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 1 /f
  167. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 1 /f
  168. @if %SystermVer% equ 8 (
  169. @echo 针对WIN8取消开机显示开始页面而直接进入桌面的选项
  170. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /v OpenAtLogon /t REG_DWORD /d 0 /f
  171. )
  172. :getCurStartType
  173. @set errmsg=to get current start type
  174. @set AutoStartDir=C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
  175. @set AutoStartDirPublic=C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
  176. @set regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  177. @set regValue=Shell
  178. @set regData=
  179. for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  180. set regData=%%b
  181. )
  182. echo [DEBUG] The value of %regValue% is: %regData%
  183. @if "%regData%" == "" (
  184. echo [DEBUG] to get Shell twice
  185. for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  186. set regData=%%b
  187. )
  188. )
  189. echo [DEBUG] The value of %regValue% is: %regData%
  190. @set explorerKey=%regData%
  191. @if "%explorerKey%" == "" (
  192. @echo Get Shell value is Empty
  193. @goto EmptyShellVal
  194. )
  195. @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%%
  196. @echo [DEBUG] explorer key:%explorerKey%
  197. @if "%explorerKey%" == "explorer.exe" (
  198. @Set CurAutoStartType=0
  199. ) else if "%explorerKey%" == "d:\run\version\vtm.exe" (
  200. @rem TODO 要考虑生产上的这些值的具体内容
  201. @echo [INFO] 检测到已设置为VTM.exe开机自启动模式
  202. @Set CurAutoStartType=2
  203. @rem 直接获取到VTM.exe的路径
  204. @set RunVersionPath=d:\run\version\
  205. ) else if "%explorerKey%" == "wscript d:\run\version\spexplorerfast.vbs" (
  206. @rem TODO 要考虑生产上的这些值的具体内容
  207. @echo [INFO] 检测到已设置为VBS脚本开机自启动模式
  208. @Set CurAutoStartType=1
  209. @rem 直接获取到VTM.exe的路径
  210. @set RunVersionPath=d:\run\version\
  211. )
  212. @if %CurAutoStartType% equ 0 (
  213. @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
  214. @Set CurAutoStartType=3
  215. @echo [INFO] 检测到设置为开始菜单自启动模式
  216. )
  217. @rem 最新安装方式,这种情况不用处理
  218. @if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
  219. @Set CurAutoStartType=4
  220. @echo [INFO] 检测到设置为安装脚本设置的开始菜单自启动模式
  221. )
  222. )
  223. @rem d:\vtm\run-4.9.4.0\run\version\vtm.exe
  224. @rem e:\run\version\vtm.exe
  225. @rem c:\run\version\vtm.exe
  226. @rem d:run\version\vtm.exe
  227. @if %CurAutoStartType% equ 404 (
  228. @echo %explorerKey% | findstr "vtm.exe" >nul && (
  229. @echo [INFO] 检测到已设置为VTM.exe开机自启动模式
  230. @Set CurAutoStartType=2
  231. )
  232. @echo %explorerKey% | findstr ".vbs" >nul && (
  233. @echo %explorerKey% | findstr "wscript" >nul && (
  234. @echo [INFO] 检测到已设置为VBS脚本开机自启动模式
  235. @Set CurAutoStartType=1
  236. )
  237. )
  238. )
  239. :EmptyShellVal
  240. @rem 检测不到的情况下,这里也做下兼容
  241. @if %CurAutoStartType% equ 404 (
  242. @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
  243. @Set CurAutoStartType=3
  244. @echo [DEBUG] 检测到设置为开始菜单自启动模式
  245. )
  246. @rem 最新安装方式,这种情况不用处理
  247. @if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
  248. @Set CurAutoStartType=4
  249. @echo [DEBUG] 检测到设置为安装脚本设置的开始菜单自启动模式
  250. )
  251. )
  252. @if %CurAutoStartType% equ 0 (
  253. @echo [DEBUG] 检测到未设置为开机自启动模式
  254. )
  255. @echo CurAutoStartType=%CurAutoStartType%
  256. @rem 设置桌面图标
  257. : setDesktopIcon
  258. @echo result=-1^&msg=set app desktop icon >%resultFile%
  259. @set errmsg=set app desktop icon
  260. @if not "%RunVersionPath%" == "" (
  261. @if exist "%RunVersionPath%" (
  262. if exist "%RunVersionPath%vtm.exe" (
  263. @echo version path got previously
  264. @goto SkipGetRunVersionPath
  265. )
  266. )
  267. )
  268. @echo [DEBUG] to get version path from syspath
  269. @set SYSPATH=%Path%
  270. @set VendorPath=%RVC_VENDOR_HOME%
  271. @rem 拆分环境变量获取Run/version目录
  272. @set manuSysPath=%SYSPATH%
  273. @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%%
  274. @echo path=%manuSysPath%
  275. @rem Mark1
  276. @set prefixPath=
  277. @set tofind=run\version
  278. @set aimStr=version
  279. @set aimLen=7
  280. @set foundstr=
  281. :loop
  282. ::从环境变量中得到版本的路径
  283. @for /f "tokens=1* delims=;" %%a in ("%manuSysPath%") do (
  284. @set str=%%a
  285. @echo !str! | findstr "%tofind%" >nul && (
  286. @set foundstr=!str!
  287. @goto foundit
  288. )
  289. @set manuSysPath=%%b
  290. )
  291. if defined manuSysPath goto :loop
  292. if "%foundstr%" == "" (
  293. @set errmsg=cannot fetch Run path from Env::path
  294. @set ret=-7
  295. @goto UserError
  296. )
  297. :foundit
  298. @rem 从全路径里头获取version结尾
  299. @echo foundstr=%foundstr%
  300. @set fulStr=%foundstr%
  301. :next
  302. if not "%fulStr%" == "" (
  303. @set /a num+=1
  304. if "!fulStr:~0,%aimLen%!" == "%aimStr%" goto subfoundit
  305. @set fulStr=%fulStr:~1%
  306. goto next
  307. )
  308. @set /a num=0
  309. :subfoundit
  310. @echo num=%num%
  311. @set /a realnum=%aimLen%+%num%
  312. @if %num% neq 0 (
  313. @set prefixPath=!foundstr:~0,%realnum%!
  314. )
  315. @echo prefixPath=%prefixPath%
  316. @if "prefixPath" == "" (
  317. @set errmsg=cannot get run version path
  318. @set ret=-8
  319. @goto UserError
  320. )
  321. @set RunVersionPath=%prefixPath%
  322. @echo RunVersionPath=%RunVersionPath%
  323. :SkipGetRunVersionPath
  324. @rem 得到vtm.exe全路径
  325. @set vtmfulPath=%RunVersionPath%vtm.exe
  326. @echo vtm exe full path is %vtmfulPath%
  327. @if not exist "%vtmfulPath%" (
  328. @echo [ERROR] %vtmfulPath% does not exist
  329. @set errmsg=%vtmfulPath% does not exist
  330. @set ret=-9
  331. @goto UserError
  332. )
  333. @set desk_path=%USERPROFILE%\Desktop
  334. @set desk_path_pub=C:\Users\Public\Desktop
  335. @for %%a in (%desk_path%\*) do echo [DEBUG] desktop file: "%%a"
  336. @for %%a in (%desk_path_pub%\*) do echo [DEBUG] public desktop file: "%%a"
  337. @echo to clear desktop file
  338. @for /d %%a in (%desk_path%\*) do rd /S /Q "%%a"
  339. @for /d %%a in (%desk_path_pub%\*) do rd /S /Q "%%a"
  340. @for %%a in (%desk_path%\*) do del "%%a"
  341. @for %%a in (%desk_path_pub%\*) do del "%%a"
  342. 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")
  343. @if exist "%desk_path%\可视柜台.lnk" (
  344. @echo [DEBUG] deskop icon is exist
  345. )
  346. @echo [DEBUG] set deskop app icon done
  347. @set errmsg=set deskop app icon done
  348. @rem 设置自启动
  349. @if %CurAutoStartType% equ 404 (
  350. @echo [WARN] unknown set auto start and skip
  351. @set ret=-2
  352. @Set errmsg=unknown set auto start and skip
  353. @goto UserError
  354. )
  355. @if %CurAutoStartType% equ 0 (
  356. @echo [WARN] no set auto start and skip
  357. @Set errmsg=no set auto start and skip
  358. @goto Done
  359. )
  360. @if %CurAutoStartType% equ 4 (
  361. @echo [WARN] auto start by new install and skip
  362. @Set errmsg=auto start by new install and skip
  363. @goto Done
  364. )
  365. @if %CurAutoStartType% equ 1 (
  366. @goto ResetRegeditExplorer
  367. )
  368. @if %CurAutoStartType% equ 2 (
  369. @goto ResetRegeditExplorer
  370. )
  371. @if %CurAutoStartType% equ 3 (
  372. @if exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
  373. @del "%AutoStartDirPublic%\招商银行可视柜台.lnk"
  374. )
  375. @if not exist "%AutoStartDirPublic%\招商银行可视柜台.lnk" (
  376. @goto setAutoStartFromStartMenu
  377. )
  378. )
  379. :ResetRegeditExplorer
  380. @echo [DEBUG] to reset regedit HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  381. @set regFile=%TEMP%\rvc_exploreset.reg
  382. @del %regFile% > nul 2>&1
  383. @reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Shell" /t REG_SZ /d "explorer.exe" /f
  384. @if %errorlevel% neq 0 (
  385. echo [WARN] add for Winlogon twice
  386. @reg add "\"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"" /v "Shell" /t REG_SZ /d "explorer.exe" /f
  387. @if !errorlevel! neq 0 (
  388. @echo [WARN] add for Winlogon third !errorlevel!
  389. @echo Windows Registry Editor Version 5.00 > %regFile%
  390. @echo. >> %regFile%
  391. @echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >> %regFile%
  392. @echo "Shell"="explorer.exe" >> %regFile%
  393. regedit /s %regFile%
  394. @del %regFile% > nul 2>&1
  395. )
  396. )
  397. @set regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  398. @set regValue=Shell
  399. @set regData=
  400. for /f "tokens=2*" %%a in ('reg query "%regKey%" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  401. set regData=%%b
  402. )
  403. echo [DEBUG] The value of %regValue% is: %regData%
  404. @if "%regData%" == "" (
  405. echo [DEBUG] to get Shell twice
  406. for /f "tokens=2*" %%a in ('reg query "\"%regKey%\"" /v "%regValue%" ^| findstr /i "%regValue%"') do (
  407. set regData=%%b
  408. )
  409. )
  410. echo [DEBUG] The value of %regValue% is: %regData%
  411. @set explorerKey=%regData%
  412. @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%%
  413. @echo [DEBUG] explorer key:%explorerKey%
  414. @if "%explorerKey%" == "explorer.exe" (
  415. @echo [DEBUG] reset explorer.exe done
  416. ) else (
  417. @echo [WARN] reset explorer.exe failed
  418. @set ret=-3
  419. @Set errmsg=reset explorer.exe failed
  420. @goto UserError
  421. )
  422. :setAutoStartFromStartMenu
  423. @echo [DEBUG] to create startup
  424. 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")
  425. @if exist "%AutoStartDir%\%NewAutoStartLnkName%" (
  426. @echo [DEBUG] auto startup app icon is exist
  427. )
  428. @echo to create startup done
  429. @set errmsg=all process has been executed succ
  430. :Done
  431. @set ret=0
  432. @echo all process has been executed done
  433. @goto End
  434. :Error
  435. @set ret=-1
  436. :UserError
  437. @echo [Error] %errmsg%
  438. :End
  439. @echo result=%ret%^&msg=%errmsg% >%resultFile%
  440. @echo result=%ret%^&msg=%errmsg%
  441. @echo %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
  442. @exit 0