[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[特效代码] [已解决]怎么避免BAT安装脚本重复运行1选项进度条会加倍?

本帖最后由 BingjianREMIX 于 2023-7-14 19:08 编辑

如题,怎么避免呢(解释:脚本进入后有四选项,1选项:安装,重复运行1选项,出现进度条加倍)(不退出脚本)

代码如下:
  1. @echo off
  2. set work=0
  3. set n=0
  4. set mo=0
  5. set number=0
  6. set all=5
  7. mode con cols=70 lines=30
  8. title MICRODOS V24.0 22H2 SETUP
  9. :window
  10. mode con cols=120 lines=40
  11. color 17
  12. cls
  13. echo.
  14. echo MICRODOS 24.0 22H2 SETUP
  15. echo ===================
  16. echo.
  17. echo [1].Install MICRODOS v24.0 22H2
  18. echo.
  19. echo [2].Uninstall MICRODOS v24.0 22H2
  20. echo.
  21. echo [3].Reset the MICRODOS v24.0 22H2
  22. echo.
  23. echo [4].Repair MICRODOS v24.0 22H2
  24. echo.
  25. echo [Q].EXIT
  26. echo.
  27. :choose
  28. set /p a=Please enter the code:
  29. if "%a%"=="1" goto :1
  30. if "%a%"=="2" goto :2
  31. if "%a%"=="3" goto :3
  32. if "%a%"=="4" goto :4
  33. if /i "%a%"=="q" exit /b
  34. cls
  35. echo ERROR
  36. pause>nul
  37. goto :window
  38. :1
  39. set work=0
  40. set n=0
  41. set mo=0
  42. set number=0
  43. set all=5
  44. cls
  45. echo.
  46. set /p programpath=Where do you want to install the software(Absolute path):
  47. echo The installation time will take about two minutes, please be patient.
  48. choice /t "3" /d y /n >nul
  49. :4b
  50. cd /d "%programpath%"
  51. cls
  52. echo Start instrall!
  53. :show
  54. :check
  55. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check
  56. cls
  57. echo Uninstalling the previous version!
  58. echo.
  59. echo %n% / %all% completed.
  60. echo.
  61. echo Completed: %work% %%%
  62. echo        \----------------------------------------------------------------------------------------------------/
  63. echo.
  64. echo.
  65. echo.
  66. echo.
  67. echo        /----------------------------------------------------------------------------------------------------\
  68. choice /t "2" /d y /n >nul
  69. if exist MICRODOS (
  70. rd /s /q MICRODOS
  71. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MICRODOS v24.0" /f
  72. pause>nul
  73. md MICRODOS
  74. goto :1pathnext
  75. ) else if not exist MICRODOS (
  76. md MICRODOS
  77. goto :1pathnext
  78. )
  79. :1pathnext
  80. set /a n=%n%+1
  81. set /a work=(%n%)*100/(%all%)
  82. set /a number=%work%/1
  83. set /a number=%number%
  84. :check2
  85. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check2
  86. cls
  87. echo The new file is being copied!
  88. echo.
  89. echo %n% / %all% completed.
  90. echo.
  91. echo Completed: %work% %%%
  92. echo        \----------------------------------------------------------------------------------------------------/
  93. echo.
  94. if not "%num%"=="" echo       %num%
  95. if not "%num%"=="" echo       %num%
  96. echo.
  97. echo        /----------------------------------------------------------------------------------------------------\
  98. choice /t "2" /d y /n >nul
  99. cd /d MICRODOS
  100. md data
  101. md Mod
  102. md Memorandum
  103. copy "%~dp0\EFI\MICRODOS Version 24.0 22H2.exe" "%cd%"
  104. copy "%~dp0\EFI\update.log" "%cd%"
  105. copy "%~dp0\EFI\urini.ini" "%cd%\data"
  106. copy "%~dp0\EFI\WindowsSerial.ini" "%cd%\data"
  107. copy "%~dp0\EFI\UNINSTALL.exe" "%cd%"
  108. cd /d "%programpath%"
  109. set /a n=%n%+1
  110. set /a work=(%n%)*100/(%all%)
  111. set /a number=%work%/1
  112. set /a number=%number%
  113. :check3
  114. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check3
  115. cls
  116. echo Installing shortcuts!
  117. echo.
  118. echo %n% / %all% completed.
  119. echo.
  120. echo Completed: %work% %%%
  121. echo        \----------------------------------------------------------------------------------------------------/
  122. echo.
  123. if not "%num%"=="" echo       %num%
  124. if not "%num%"=="" echo       %num%
  125. echo.
  126. echo        /----------------------------------------------------------------------------------------------------\
  127. choice /t "2" /d y /n >nul
  128. echo set WshShell = WScript.CreateObject("WScript.Shell")>setup.vbs
  129. echo strDesktop = WshShell.SpecialFolders("Desktop")>>setup.vbs
  130. echo set oShellLink = WshShell.CreateShortcut(strDesktop ^& "\MICRODOS Version 24.0 22H2.lnk")>>setup.vbs
  131. echo oShellLink.TargetPath ="%programpath%\MICRODOS\MICRODOS Version 24.0 22H2">>setup.vbs
  132. echo oShellLink.WorkingDirectory = strDesktop>>setup.vbs
  133. echo oShellLink.IconLocation = "%programpath%\MICRODOS\MICRODOS Version 24.0 22H2", 0>>setup.vbs
  134. echo oShellLink.Save>>setup.vbs
  135. call setup.vbs
  136. cls
  137. del /f /q setup.vbs
  138. set /a n=%n%+1
  139. set /a work=(%n%)*100/(%all%)
  140. set /a number=%work%/1
  141. set /a number=%number%
  142. :check4
  143. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check4
  144. cls
  145. echo Installing the registry!
  146. echo.
  147. echo %n% / %all% completed.
  148. echo.
  149. echo Completed: %work% %%%
  150. echo        \----------------------------------------------------------------------------------------------------/
  151. echo.
  152. if not "%num%"=="" echo       %num%
  153. if not "%num%"=="" echo       %num%
  154. echo.
  155. echo        /----------------------------------------------------------------------------------------------------\
  156. choice /t "2" /d y /n >nul
  157. set "ProgramName=MICRODOS v24.0 22H2"
  158. set "ProgramDisplayName=MICRODOS Version 24.0 22H2"
  159. set "UninstallString=%programpath%\MICRODOS\UNINSTALL.exe"
  160. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /f
  161. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "DisplayName" /d "%ProgramDisplayName%" /f
  162. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "UninstallString" /d "%UninstallString%" /f
  163. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "Publisher" /d "REMIX LASER RISING STUDIO" /f
  164. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "DisplayIcon" /d "%programpath%\MICRODOS\MICRODOS Version 24.0 22H2.exe" /f
  165. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "DisplayVersion" /d "22H2 24.0.23629.1612" /f
  166. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProgramName%" /v "EstimatedSize" /t "REG_DWORD" /d "1850" /f
  167. cls
  168. set /a n=%n%+1
  169. set /a work=(%n%)*100/(%all%)
  170. set /a number=%work%/1
  171. set /a number=%number%
  172. :check5
  173. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check5
  174. cls
  175. echo Completing Installation! PLEASE,WAIT!
  176. echo.
  177. echo %n% / %all% completed.
  178. echo.
  179. echo Completed: %work% %%%
  180. echo        \----------------------------------------------------------------------------------------------------/
  181. echo.
  182. if not "%num%"=="" echo       %num%
  183. if not "%num%"=="" echo       %num%
  184. echo.
  185. echo        /----------------------------------------------------------------------------------------------------\
  186. choice /t "5" /d y /n >nul
  187. cls
  188. set /a n=%n%+1
  189. set /a work=(%n%)*100/(%all%)
  190. set /a number=%work%/1
  191. set /a number=%number%
  192. :check6
  193. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check6
  194. cls
  195. echo Finish Install!
  196. echo.
  197. echo %n% / %all% completed.
  198. echo.
  199. echo Completed: %work% %%%
  200. echo        \----------------------------------------------------------------------------------------------------/
  201. echo.
  202. if not "%num%"=="" echo       %num%
  203. if not "%num%"=="" echo       %num%
  204. echo.
  205. echo        /----------------------------------------------------------------------------------------------------\
  206. choice /t "2" /d y /n >nul
  207. echo Please push any key to continue
  208. pause>nul
  209. goto :window
复制代码
代码里涉及注册表,可以删除,不影响
QQ 1980286392

进度条应该是这一段
  1. set work=0
  2. set n=0
  3. set mo=0
  4. set number=0
  5. set all=5
  6. :show
  7. :check
  8. if %number% GTR %mo% set num=%num%��&set /a mo=%mo%+1&goto check
  9. cls
  10. echo Uninstalling the previous version!
  11. echo.
  12. echo %n% / %all% completed.
  13. echo.
  14. echo Completed: %work% %%%
  15. echo        \----------------------------------------------------------------------------------------------------/
  16. echo.
  17. echo.
  18. echo.
  19. echo.
  20. echo        /----------------------------------------------------------------------------------------------------\
复制代码
QQ 1980286392

TOP

  1. :2
  2. cls
  3. echo.
  4. set /p programpath=Where did you installed the software(Absolute path):
  5. cd /d "%programpath%"
  6. if not exist "MICRODOS" (
  7. cls
  8. echo You have not install MICRODOS!
  9. echo Please push any key to continue
  10. pause>nul
  11. goto :window
  12. ) else cls
  13. :2a
  14. echo ARE YOU SURE YOU WANT TO UNINSTALL MICRODOS?(Y/N)
  15. set /p a=^>
  16. if /i "%a%"=="y" goto :uninstall
  17. if /i "%a%"=="n" goto :window
  18. goto :2a
  19. :uninstall
  20. echo MICRODOS Version 24.0 is being completely removed from your computer!
  21. echo It is about a few seconds.PLEASE.WAIT!
  22. rd /q /s MICRODOS
  23. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MICRODOS v24.0 22H2" /f
  24. echo Uninstall complete!
  25. echo Please push any key to continue!
  26. pause>nul
  27. goto :window
  28. :3
  29. cls
  30. echo.
  31. set /p programpath=Where did you installed the software(Absolute path):
  32. cd /d "%programpath%"
  33. if not exist "MICRODOS" (
  34. cls
  35. echo You have not install MICRODOS!
  36. echo Please push any key to continue
  37. pause>nul
  38. goto :window
  39. ) else cls
  40. echo:Resetting MICRODOS will lose everything you did at MICRODOS, including your mods, login data, saved activation codes, and if you want to continue using these after the reset, you can back them up somewhere other then the installation path and restore them to their original location after the MICRODOS reset is complete.
  41. echo NOW YOU ALSO HAVE TIME TO EXIT IF YOU HAVE WRONG ENTER!
  42. echo PLEASE HURRY UP EXIT IN 10 SECONDS!
  43. choice /t "10" /d y /n >nul
  44. rd /q /s MICRODOS
  45. echo going to install...
  46. choice /t "1" /d y /n >nul
  47. set work=0
  48. set n=0
  49. set mo=0
  50. set number=0
  51. set all=5
  52. goto :4b
  53. :4
  54. cls
  55. echo.
  56. set /p programpath=Where did you installed the software(Absolute path):
  57. cd /d "%programpath%"
  58. if not exist MICRODOS (
  59. echo You haven't install MICRODOS yet!
  60. pause>nul
  61. goto :window
  62. )
  63. :4a
  64. cls
  65. echo.
  66. echo Please choose what you want to repair!
  67. echo.
  68. echo [1] MICRODOS v24.0 22H2
  69. echo.
  70. echo [2] WindowsSerial.ini
  71. echo.
  72. echo [3] update.log
  73. echo.
  74. echo [4] UNINSTALL.exe
  75. echo.
  76. echo [Q] EXIT
  77. echo.
  78. set /p repair=What your choose:
  79. if "%repair%" equ "1" (
  80. del "%programpath%\MICRODOS\MICRODOS Version 24.0 22H2.exe"
  81. cd /d "%~dp0\EFI"
  82. copy "MICRODOS Version 24.0 22H2.exe" "%programpath%\MICRODOS"
  83. cls
  84. echo Repair Complete!
  85. pause>nul
  86. goto :4a
  87. ) else if "%repair%" equ "2" (
  88. del "%programpath%\MICRODOS\data\WindowsSerial.ini"
  89. cd /d "%~dp0\EFI"
  90. copy "WindowsSerial.ini" "%programpath%\MICRODOS\data"
  91. cls
  92. echo Repair Complete!
  93. pause>nul
  94. goto :4a
  95. ) else if "%repair%" equ "3" (
  96. del "%programpath%\MICRODOS\update.log"
  97. cd /d "%~dp0\EFI"
  98. copy "update.log" "%programpath%\MICRODOS"
  99. cls
  100. echo Repair Complete!
  101. pause>nul
  102. goto :4a
  103. ) else if "%repair%" equ "4" (
  104. del "%programpath%\MICRODOS\UNINSTALL.exe"
  105. cd /d "%~dp0\EFI"
  106. copy "UNINSTALL.exe" "%programpath%\MICRODOS"
  107. cls
  108. echo Repair Complete!
  109. pause>nul
  110. goto :4a
  111. ) else if /i "%repair%" equ "q" (
  112. goto :window
  113. ) else goto :4a
复制代码
QQ 1980286392

TOP

返回列表