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

[其他] 发个批处理功能,在这里算是得到帮助过

有更新了,地址http://www.bathome.net/viewthread.php?tid=46905&extra=,较大变化


主要是用来打包exe单文件,简化操作(左边功能),以及其他一些功能(也在可能加入中)
下面地址是包括内含文件的,有需要的下去的吾爱去下载就行
https://www.52pojie.cn/thread-656608-1-1.html
10.20 昨天有点事,没发全,这东西调用7z和winrar打包exe单文件,发bat代码,不提供里面调用的程序,免得被人说有毒.主要是自己用,哈哈,有限字数的么?发不出,所小于10个字符,可能太长,不能发代码格式,就这样吧
下面进行了大更改,少了约200行,
10.26更改完成的,大更新就更改下
10.27之前的reg转bat chm反编译的文件名中有空格问题已解决
11.7增加了window bitlocker常规操作功能(慎重使用)[密码解密 2.密钥解密 3.恢复加密 4.添加加密 5.修改密码 6.清除加密](需要系统支持,目前没找到大神做出的绿色bitlocker),同时改进了一些功能,也增加延时自动功能
  1. @echo off&color a&Mode con cols=88 lines=26
  2. set batname=批处理(自动化)多功能组合&set batver=Ver.3.2&set battime=(2017.11.7)
  3. set pp=E:\files\7zsoft&set dp=%temp%\1temp
  4. rd /s/q %dp%&md %dp%&md %dp%\file&md %dp%\st&if not exist %pp% md %pp%
  5. set winrar=soft\3rdParty\WinRAR\WinRAR.exe&set szz=soft\3rdParty\7z\7zG.exe
  6. :: 说明:暂无问题发现
  7. :soft
  8. title   %batname%%batver%%battime%  by  零点三点零
  9. set start=<nul&set pa=<nul&set ne=<nul&set ee=<nul&set bit=<nul&set ee64=<nul&set ico=<nul&set inn=<nul&set src=<nul&set dst=<nul&set str=<nul&set vcnn=<nul&set vdnn=<nul&set dnn=<nul&set paa=<nul&set inpa=<nul&set dav=<nul
  10. if not exist %dp% md %dp%&if not exist %dp%\file md %dp%\file&if not exist %dp%\st md %dp%\st&if not exist %pp% md %pp%
  11. cls&echo.&echo.&cd /d "%~dp0"
  12. echo            ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  13. echo            ☆                                                              ☆
  14. echo            ★              %batname% - %batver%              ★
  15. echo            ☆                                                              ☆
  16. echo            ★           W.完整封装单文件        1.批量转空值文件           ★
  17. echo            ☆           M.编辑启动文件          2.CHM文件反编译            ☆
  18. echo            ★           I.重置程序信息          3.Reg转换为Bat             ★        
  19. echo            ☆           R.启动7z软件制作        4.EXE文件信息定制          ☆
  20. echo            ★           N.制作程序多ICO         5.批量压缩文件夹           ★
  21. echo            ☆           T.添加管理员权限        6.Bitlocker操作            ☆
  22. echo            ★           F.启动Winrar制作                                   ★
  23. echo            ☆           A.封装文件夹查看                                   ☆
  24. echo            ★           S.设置封装程序                                     ★
  25. echo            ☆           Z.清理垃圾及退出        0.清理系统垃圾(隐形)       ☆
  26. echo            ★                                                              ★
  27. echo            ☆            当前时间:%date:~0,4%年%date:~5,2%月%date:~8,2%日 星期%date:~-1,1% %time:~0,2%时%time:~3,2%分           ☆
  28. echo            ★                                                              ★
  29. echo            ☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
  30. echo                                                              by:1145846856  
  31. echo.                                   %1                             
  32. echo.........................................................................................
  33. echo.
  34. @set /p start=请选择 (菜单字符) 后按回车键:
  35. if /i "%start%"=="w" ( call :copyfile
  36. )else (if /i "%start%"=="m" ( start soft\notepad.exe %dp%\file\a.bat&call :soft
  37. )else (if /i "%start%"=="i" ( call :fileiic
  38. )else (if /i "%start%"=="r" ( call soft\7z.bat&call :soft
  39. )else (if /i "%start%"=="n" ( call :iico
  40. )else (if /i "%start%"=="t" ( call :de
  41. )else (if /i "%start%"=="f" ( call :winrar
  42. )else (if /i "%start%"=="a" ( call :ffname
  43. )else (if /i "%start%"=="s" ( call :settings
  44. )else (if /i "%start%"=="1" ( call :onlysoft
  45. )else (if /i "%start%"=="2" ( call :bchm
  46. )else (if /i "%start%"=="3" ( call :vbr
  47. )else (if /i "%start%"=="4" ( call :inff&call :soft
  48. )else (if /i "%start%"=="5" ( call :yasuo
  49. )else (if /i "%start%"=="6" ( call :bitlock
  50. )else (if /i "%start%"=="z" ( rd /s/q %dp%&rd /s/q %temp%\sun&exit
  51. )else (if /i "%start%"=="0" ( call :ctemp
  52. )else ( call :soft "操作错误,请重操作")))))))))))))))))
  53. :copyfile
  54. ::复制文件,去掉引号
  55. rd /s/q %dp%\file&md %dp%\file&cls
  56. call :list 复制封装文件 1 a b c d e f g :dcc :soft :copyfile "请拖入文件路径或exe文件(0,z,返回主菜单):" %1
  57. :dcc
  58. set ne=%~x1&set paa=%pa%
  59. if /i "%ne%"==".exe" xcopy "%pa%" "%dp%\file"&&call :fileiic
  60. dir/ad "%pa%" >nul 2>nul&&call :copyff||call :copyfile "非路径,exe文件,重置"
  61. :copyff
  62. ROBOCOPY "%pa%" * "%dp%\file" /s&call :fileiic
  63. :fileiic
  64. ::获取程序信息,下面部份无法在本文件执行,只能生成bat由本文件call调用
  65. echo var objShell = new ActiveXObject('Shell.Application'); >%dp%\css.bat
  66. echo var m = WSH.StdIn.ReadLine().match(/^^(.+)\\([^^\\]+\.[^^\.]+)$/i); >>%dp%\css.bat
  67. echo try { >>%dp%\css.bat
  68. echo var objFolder = objShell.NameSpace(m[1]); >>%dp%\css.bat
  69. echo var objItem = objFolder.ParseName(m[2]); >>%dp%\css.bat
  70. echo for (var i=0; i^<287; i++){  >>%dp%\css.bat
  71. echo        var info = objFolder.GetDetailsOf(objItem, i); >>%dp%\css.bat
  72. echo         if(info)WSH.echo(objFolder.GetDetailsOf(null, i)+":"+info); >>%dp%\css.bat
  73. echo   } >>%dp%\css.bat
  74. echo }catch(e){WSH.echo("路径或文件名无效!");} >>%dp%\css.bat
  75. del /q/s/f %dp%\st\1.txt&cls
  76. call :list 获取版本信息 0 a b c d e f g :icc :copyfile :fileiic "请选序号或直接拖入(z,返回上级,0,返回主菜单):" %1
  77. :icc
  78. set ee=%~nx1&set ne=%~n1
  79. call "%~dp0soft\ico.exe"  "%pa%" 1  %dp%\st\0.ico
  80. echo %pa%|cscript -nologo -e:jscript %dp%\css.bat >>%dp%\st\1.txt
  81. if /i "%start%" equ "i" ( call :info)else ( call :bty)
  82. :bty
  83. ::设置程序是否为单32位或64位,双位即为32和64位
  84. call :list 启动软件设置 1 1.单位程序 2.双位程序 c d e f g :btyy :fileiic :bty "设置程序(含32和64位)(1,2,z返回上级,0返回主菜单):" %1
  85. :btyy
  86. set bit=%1
  87. if /i %bit% equ "1" ( call :kky)else ( if /i %bit% equ "2" ( call :kky)else ( call :bty "操作错误,请重操作"))
  88. :kky
  89. ::启动程序名
  90. if /i %bit% equ "1" ( call :list 运行程序设定 0 a b c d e f g :gfn :bty :kky "请拖入或选择(z,返回上级,0返回主菜单):" %1
  91. )else ( if /i %bit% equ "2" ( call :list 运行程序设定 0 a b c d e f g :gfn :bty :kky "请拖入或选择32位(z,返回上级,0返回主菜单):" %1
  92. )else ( call :kky "操作错误,请重操作"))
  93. :gfn
  94. set ee=%~nx1&set ne=%~n1
  95. if /i %bit%=="1" ( goto :na)else ( call :kkn)
  96. :kkn
  97. if /i %bit% equ "2" ( call :list 运行程序设定 0 a b c d e f g :gfn64 :kky :kkn "请拖入或选择64位(z,返回上级,0返回主菜单):" %1)else ( call :kkn "操作错误,请重操作")
  98. :gfn64
  99. set ee64=%~nx1&goto :na
  100. :na
  101. ::a.bat启动文件
  102. echo @echo off>%dp%\file\a.bat
  103. echo ::公共注册内容,如有问题,尝试开启管理员权限>>%dp%\file\a.bat
  104. echo ::reg add "HKCU\Software\...." /v "..." /t REG_DWORD /d 0 /f>>%dp%\file\a.bat
  105. if /i %bit% equ "2" echo if /i "%%PROCESSOR_IDENTIFIER:~0,3%%" == "x86" ( >>%dp%\file\a.bat
  106. echo tasklist^|findstr /i "%ee%"^&taskkill /f /im "%ee%">>%dp%\file\a.bat
  107. echo call  "%ee%">>%dp%\file\a.bat
  108. echo tasklist^|findstr /i "%ee%"^&taskkill /f /im "%ee%">>%dp%\file\a.bat
  109. if /i %bit% equ "2" echo )else ( >>%dp%\file\a.bat
  110. if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&taskkill /f /im "%ee64%">>%dp%\file\a.bat
  111. if /i %bit% equ "2" echo call "%ee64%">>%dp%\file\a.bat
  112. if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&taskkill /f /im "%ee64%")>>%dp%\file\a.bat
  113. echo :a>>%dp%\file\a.bat
  114. echo ::公共删除注内容>>%dp%\file\a.bat
  115. echo ping 127.1 -n 2 ^>nul>>%dp%\file\a.bat
  116. if /i %bit% equ "2" echo if /i "%%PROCESSOR_IDENTIFIER:~0,3%%" == "x86" ( >>%dp%\file\a.bat
  117. echo tasklist^|findstr /i "%ee%"^&^&goto :a^|^|goto :b>>%dp%\file\a.bat
  118. if /i %bit% equ "2" echo )else ( >>%dp%\file\a.bat
  119. if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&^&goto :a^|^|goto :b)>>%dp%\file\a.bat
  120. echo :b>>%dp%\file\a.bat
  121. echo ::reg delete "HKCU\Software....." /f>>%dp%\file\a.bat
  122. echo ::reg delete "HKCU\Software\WOW6432Node\....." /f>>%dp%\file\a.bat
  123. echo cd..^&rd /s/q "%%~dp0">>%dp%\file\a.bat
  124. echo del /q/s/f "%%~f0" 2>nul>>%dp%\file\a.bat
  125. echo exit>>%dp%\file\a.bat&call :info
  126. :info
  127. ::下面7zSFX资料ini.txt
  128. echo ;!@Install@!UTF-8!>%dp%\st\ini.txt
  129. echo InstallPath="%%Temp%%\\sun\\%ne%">>%dp%\st\ini.txt
  130. echo GUIMode="2">>%dp%\st\ini.txt
  131. echo RunProgram="hidcon:\"a.bat\"">>%dp%\st\ini.txt
  132. echo ;Config file generated by 7z SFX Builder v2.1. (https://www.52pojie.cn/thread-656608-1-1.html)>>%dp%\st\ini.txt
  133. echo ;!@InstallEnd@!>>%dp%\st\ini.txt
  134. echo 7zSFXBuilder_SFXName=%pp%\%ee%>>%dp%\st\ini.txt
  135. echo 7zSFXBuilder_SFXIcon=%dp%\st\0.ico>>%dp%\st\ini.txt
  136. echo 7zSFXBuilder_UseDefMod=7zsd_LZMA2>>%dp%\st\ini.txt
  137. echo 7zSFXBuilder_SFXFile_1=%dp%\file\*>>%dp%\st\ini.txt
  138. echo 7zSFXBuilder_7Zip_Level=Ultra>>%dp%\st\ini.txt
  139. echo 7zSFXBuilder_7Zip_Method=LZMA2>>%dp%\st\ini.txt
  140. echo 7zSFXBuilder_7Zip_Dictionary=64 MB>>%dp%\st\ini.txt
  141. echo 7zSFXBuilder_7Zip_BlockSize=Solid>>%dp%\st\ini.txt
  142. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件版本" %dp%\st\1.txt') do (
  143. echo 7zSFXBuilder_Res_FileVersion=%%b>>%dp%\st\ini.txt
  144. echo 7zSFXBuilder_Res_ProductVersion=%%b>>%dp%\st\ini.txt)
  145. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件说明" %dp%\st\1.txt') do (
  146. echo 7zSFXBuilder_Res_FileDescription=%%b>>%dp%\st\ini.txt)
  147. for /f "tokens=1-2 delims=:" %%a in ('findstr /r "名称" %dp%\st\1.txt') do (
  148. if /i "%%a" =="名称"  echo 7zSFXBuilder_Res_ProductName=%%b>>%dp%\st\ini.txt)
  149. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件名" %dp%\st\1.txt') do (
  150. echo 7zSFXBuilder_Res_OriginalFileName=%%b>>%dp%\st\ini.txt)
  151. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "公司" %dp%\st\1.txt') do (
  152. echo 7zSFXBuilder_Res_CompanyName=%%b>>%dp%\st\ini.txt)
  153. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "版权" %dp%\st\1.txt') do (
  154. echo 7zSFXBuilder_Res_LegalCopyright=%%b>>%dp%\st\ini.txt)
  155. ::下面为winrar调用
  156. echo Path=%%temp%%\sun\%ne%>%dp%\st\win.txt&echo Setup=run.vbs>>%dp%\st\win.txt
  157. echo Silent=1 >>%dp%\st\win.txt&echo Overwrite=1 >>%dp%\st\win.txt
  158. if /i "%start%" equ "i" ( call :soft)else ( call :win7z)
  159. :win7z
  160. call :list 封装方式先定 1 1.选择7zSFX 2.选择Winrar c d e f g :win7zz :kky :win7z "请选择(z返回上级,0返回主菜单):" %1
  161. :win7zz
  162. if /i "%pa%" equ "1" ( call :7zinf)else (if /i "%pa%" equ "2" ( call :winin)else ( call :win7z "操作错误,请重操作"))
  163. :7zinf
  164. if exist "%pp%\%ee%" del /s/q "%pp%\%ee%"
  165. cls&if /i "%start%" equ "w" call soft\7z.bat
  166. call :delyy 删除封装完成原文件 封装完成原文件
  167. :winrar
  168. ::直接调用Winrar时此处选择程序
  169. call :list Winrar运行程序 0 a b c d e f g :wgfn :kky :kky "请拖入或选择(z,返回上级,0返回主菜单):" %1
  170. :wgfn
  171. set ee=%~nx1&set ne=%~n1&call :winin
  172. :winin
  173. echo CreateObject("WScript.Shell").Run "cmd /c .\a.bat",0 >%dp%\file\run.vbs
  174. if exist "%pp%\%ee%" del /s/q "%pp%\%ee%"
  175. cls&%winrar% a -m5 -s -r -sfx -o+ -z%dp%\st\win.txt -iicon%dp%\st\0.ico "%pp%\%ee%" -ep1 "%dp%\file\"
  176. call :inff&if /i "%start%" equ "f" call :soft
  177. call :delyy 删除封装完成原文件 封装完成原文件
  178. :inff
  179. ::版本信息设置
  180. if exist "soft\inf\setting.ini" del /s/q "soft\inf\setting.ini"&cls
  181. echo [setting] >soft\inf\setting.ini
  182. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件版本" %dp%\st\1.txt') do (
  183. echo 文件版本1=%%b >>soft\inf\setting.ini
  184. echo 产品版本=%%b >>soft\inf\setting.ini)
  185. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件说明" %dp%\st\1.txt') do (
  186. echo 描述=%%b >>soft\inf\setting.ini)
  187. for /f "tokens=1-2 delims=:" %%a in ('findstr /r "名称" %dp%\st\1.txt') do (
  188. if /i "%%a" =="名称"  echo 产品名称=%%b >>soft\inf\setting.ini)
  189. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件名" %dp%\st\1.txt') do (
  190. echo 源文件名=%%b >>soft\inf\setting.ini)
  191. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "公司" %dp%\st\1.txt') do (
  192. echo 公司=%%b >>soft\inf\setting.ini)
  193. for /f "tokens=1-2 delims=:" %%a in ('findstr /l "版权" %dp%\st\1.txt') do (
  194. echo 版权=%%b >>soft\inf\setting.ini)
  195. echo 语言=中文 >>soft\inf\setting.ini
  196. tasklist /nh|find /i "inf.exe"&&taskkill /f /im "inf.exe"
  197. cls&if ERRORLEVEL 0 (call soft\inf\inf.exe)&del /s/q "%pp%\*.bak"&goto :eof
  198. :iico
  199. ::多ICO图片制作
  200. if not exist %dp%\file\main.exe copy soft\au3\main.exe %dp%\file
  201. if not exist %dp%\file\ico md %dp%\file\ico&cls
  202. call :list 多ICO图片制作 0 a b c d e f g :iicoo :soft :iico "多ico制作请拖入或选取文件(0,z,返回主菜单):" %1
  203. :iicoo
  204. set /p in=请输入ICO文件名:
  205. set inn=%in%.ico&set ico=%pa%
  206. for /f "tokens=1-2 delims=:" %%a in ('findstr /b /i "%ico%" %dp%\st\2.txt') do (set ico=%%b)
  207. call soft\ico.exe  "%ico%" 1  %dp%\file\ico\%inn%&call :iico
  208. :ffname
  209. ::需查看文件夹
  210. call :list 进入文件夹 1 1.封装保存文件夹 2.封装运行文件夹 3.临时1Temp文件夹 4.临时file文件夹 5.本程序文件夹 6.编辑SET.bat g :ffnamee :soft :ffname "选择文件夹序号(0,z,反回主菜单):" %1
  211. :ffnamee
  212. if /i "%pa%"=="1" ( start /i "" "%pp%"&call :soft
  213. )else (if /i "%pa%"=="2" ( start /i "" "%temp%\sun"&call :soft
  214. )else (if /i "%pa%"=="3" ( start /i "" "%dp%"&call :soft
  215. )else (if /i "%pa%"=="4" ( start /i "" "%dp%\file"&call :soft
  216. )else (if /i "%pa%"=="5" ( start /i "" "%~dp0"&call :soft
  217. )else (if /i "%pa%"=="6" ( start soft\notepad.exe set.bat&call :soft
  218. )else ( call :ffname "操作错误,请重操作"))))))
  219. :de
  220. ::权限添加
  221. if exist %dp%\file\a.bat findstr /v "@echo" "%dp%\file\a.bat">%dp%\st\b.bat
  222. call :quan %dp%\file\a.bat 0
  223. type %dp%\st\b.bat >>%dp%\file\a.bat&call :soft
  224. :onlysoft
  225. ::批量制作空值文件
  226. del /s/q %dp%\st\s.txt&rd /s/q %dp%\file&md %dp%\file&cls
  227. call :list 空值文件制作 1 a b c d e f g :nasoft :soft :onlysoft "请直接拖执行文件夹按回车(0,z,返回主菜单):" %1
  228. :nasoft
  229. dir/ad "%pa%" >nul 2>nul&&cd /d "%pa%"||call :onlysoft "不是路径,请重操作"
  230. cls&set paa=%pa%&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  231. echo.                                      正在写入中......
  232. setlocal enabledelayedexpansion
  233. for /f "delims=" %%i in ('dir /b /a-d /s "*"') do ( echo %%~i >>%dp%\st\s.txt)
  234. set "src=%pa%"&set "dst=%dp%\file"
  235. (for /f "delims=" %%a in (%dp%\st\s.txt) do ( set "str=%%a"
  236.     echo,!str:%src%=%dst%! ))>%dp%\#
  237. move %dp%\# %dp%\st\s.txt
  238. cls&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  239. echo.                                      已写入完成......
  240. for /f "delims=" %%a in (%dp%\st\s.txt) do ( call :vcn "%%a")
  241. setlocal disabledelayedexpansion
  242. cls&start explorer.exe %dp%\file&call :delyy 删除复制完成原文件 已被复制原文件
  243. :vcn
  244. set vcnn=%~dp1&set vdnn=%~nx1&md "%vcnn%"
  245. echo .>"%vcnn%%vdnn%"&goto :eof
  246. :bchm
  247. call :list CHM文件反编译 1 a b c d e f g :zz :soft :bchm "要反编的CHM电子书拖进来(0,z,返回主菜单):" %1
  248. :zz
  249. set ne=%~x1
  250. if /i "%ne%"==".chm" ( call :chm "%pa%")else ( call :bchm "非chm文件,请重操作")
  251. :chm
  252. set dnn=%~n1
  253. %szz% x "%pa%" -o"%dp%\file\%dnn%"
  254. del /f /s /q "%dp%\file\%dnn%\*$*.*"&del /f /s /q "%dp%\file\%dnn%\*#*.*"
  255. for /f %%i in ('dir /ad /b "%dp%\file\%dnn%\$*"') do rd /s /q "%dp%\file\%dnn%\%%i"
  256. start explorer.exe %dp%\file&call :soft
  257. :vbr
  258. ::转换vbs bat
  259. call :list 将REG转为BAT 1 a b c d e f g :vn :soft :vbr "请拖入需转换文件(0,返回主菜单):" %1     
  260. :vn
  261. set ne=%~x1&set ee=%~nx1&set vcnn=%~dp1&set vdnn=%~n1.bat
  262. if /i "%ne%"==".reg" ( copy "%pa%" "%dp%"\st&del /q/s "%pa%"
  263. call soft\Reg2Bat.vbs "%dp%\st\%ee%"
  264. start soft\notepad.exe "%dp%\st\%vdnn%"&call :soft)else ( call :vbr "非REG文件,请重操作")
  265. :yasuo
  266. ::批量压缩
  267. call :list 批量压缩路径 1 a b c d e f g :yass :soft :yasuo "请拖入压缩路径(0,z,返回主菜单):" %1
  268. :yass
  269. dir/ad "%pa%" >nul 2>nul&&set paa=%pa%||call :yasuo "不是路径,请重操作"
  270. call :yalu
  271. :yalu
  272. call :list 批量压缩路径 1 a b c d e f g :yaluu :yasuo :yalu "设置保存路径(0,z返回主菜单):" %1
  273. :yaluu
  274. dir/ad "%pa%" >nul 2>nul&&set inpa=%pa%||call :yalu "不是路径,请重操作"
  275. call :yafang
  276. :yafang
  277. call :list 批量压缩方式 1 1.选择7z压缩 2.选择Winrar压缩 c d e f g :fangshi :yalu :yafang "请选择(1,7z,2,Winrar,0,返回主菜单):" %1
  278. :fangshi
  279. if /i "%pa%"=="1" ( cls&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  280. echo.                                    正在压缩中......
  281. (for /f "delims=" %%i in ('dir /b "%paa%\*"') do (dir/ad "%paa%\%%i" >nul 2>nul&&%szz% a -mx=9 -m0=LZMA2 "%inpa%\%%i.7z" "%paa%\%%i\*"||%szz% a -mx=9 -m0=LZMA2 "%inpa%\%%i.7z" "%paa%\%%i"))&call :delfile)else ( if /i "%pa%"=="2" ( cls&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  282. echo.                                    正在压缩中......
  283. (for /f "delims=" %%i in ('dir /b "%paa%\*"') do ( dir/ad "%paa%\%%i" >nul 2>nul&&"%winrar%" a -m5 -s -r -o+ "%inpa%\%%i.rar" -ep1 "%paa%\%%i\"||"%winrar%" a -m5 -s -r -o+ "%inpa%\%%i.rar" -ep1 "%paa%\%%i"))&call :delfile)else ( call :yafang "操作错误,请重操作"))
  284. :delfile
  285. call :delyy 删除已被压缩原文件 已被压缩原文件
  286. :bitlock
  287. ::系统bitlocker操作
  288. call :quan %dp%\bitlocker.bat 1
  289. echo call :dy>>%dp%\bitlocker.bat
  290. echo :dy>>%dp%\bitlocker.bat&echo cls^&echo.>>%dp%\bitlocker.bat
  291. echo echo.                      %batname%-Bitlocker设置管理>>%dp%\bitlocker.bat
  292. echo echo.>>%dp%\bitlocker.bat
  293. echo echo.                                    %%1>>%dp%\bitlocker.bat
  294. echo echo.^&if /i "%%pa%%" equ "" set pa=k:>>%dp%\bitlocker.bat
  295. echo if /i "%%2"=="1" call :dd>>%dp%\bitlocker.bat
  296. echo if /i "%%2"=="2" call :unlock>>%dp%\bitlocker.bat
  297. echo if /i "%%2"=="3" call :milock>>%dp%\bitlocker.bat
  298. echo set /p inpa=当前分区是:"%%pa%%",请输入分区字母,不更改直接回车: >>%dp%\bitlocker.bat
  299. echo if /i "%%inpa%%"=="" ( call :dd)else ( set pa=%%inpa%%:^& call :dd)>>%dp%\bitlocker.bat
  300. echo :dd>>%dp%\bitlocker.bat
  301. echo echo.处理分区:"%%pa%%": 1.密码解密 2.密钥解密 3.恢复加密 4.添加加密 5.修改密码 6.清除加密>>%dp%\bitlocker.bat
  302. echo echo.^&set /p na=请选择解密还是加密(0返回上级,1,2,3,4,5,6):>>%dp%\bitlocker.bat
  303. echo if "%%na%%"=="0" ( call :st)else ( if "%%na%%"=="1" ( goto :unlock)else ( if "%%na%%"=="2" ( goto :milock)else ( if "%%na%%"=="3" ( goto :lock)else ( if "%%na%%"=="4" ( goto :nlock)else ( if "%%na%%"=="5" ( goto :npw)else ( if "%%na%%"=="6" ( goto :nnlock)else ( call :dy "操作错误" 1)))))))>>%dp%\bitlocker.bat
  304. echo :unlock>>%dp%\bitlocker.bat
  305. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&call :dy "解密成功"^|^|%%systemroot%%\system32\manage-bde.exe -unlock %%pa%% -pw^&^&call :dy "解密成功"^|^|call :dy "密码错误" 2 >>%dp%\bitlocker.bat
  306. echo :milock>>%dp%\bitlocker.bat
  307. echo set /p xx=输入密钥:>>%dp%\bitlocker.bat
  308. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&call :dy "解密成功"^|^|%%systemroot%%\system32\manage-bde.exe -unlock %%pa%% -rp %%xx%%^&^&call :dy "解密成功"^|^|call :dy "密钥错误" 3 >>%dp%\bitlocker.bat
  309. echo :lock>>%dp%\bitlocker.bat
  310. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -lock -fd %%pa%%^&^&call :dy "加密成功"^|^|call :dy "操作错误" 1>>%dp%\bitlocker.bat
  311. echo :nlock>>%dp%\bitlocker.bat
  312. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -on %%pa%% -rp^>%dp%\st\pw.txt^|^|call :dy "操作错误" 1>>%dp%\bitlocker.bat
  313. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -protectors -add %%pa%% -pw^&^&start "%~dp0soft\notepad.exe" %dp%\st\pw.txt^&^&call :st "添加密码成功"^|^|call :dy "操作错误" 1 >>%dp%\bitlocker.bat
  314. echo :npw>>%dp%\bitlocker.bat
  315. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -changepassword %%pa%%^&^&call :dy "修改密码成功"^|^|call :dy "操作错误" 1 >>%dp%\bitlocker.bat
  316. echo :nnlock>>%dp%\bitlocker.bat
  317. echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -off %%pa%%^&^&call :dy "清除加密成功"^|^|call :dy "操作错误" 1>>%dp%\bitlocker.bat
  318. call %dp%\bitlocker.bat&call :soft
  319. :list
  320. :: %1名,%2(0,显,1不显)是否显(生成)exe列表,a到g为临时菜单名,%10转回下级,%11返回上级,%12错误返回处,%13选择名,%14错误值
  321. cls&echo.&echo                           %batname%-%1
  322. ::生成并列出exe程序表
  323. set dav=%2
  324. if /i "%dav%"=="1" goto :lable
  325. if exist %dp%\st\2.txt del /s/q %dp%\st\2.txt
  326. cls&echo.&echo                           %batname%-%1
  327. setlocal enabledelayedexpansion      
  328. set n=0
  329. (for /f "delims=" %%a in ('dir /b "%dp%\file\*.exe"') do ( set /a n%%=99&set /a n+=1
  330. echo !n!:%dp%\file\%%a>>%dp%\st\2.txt
  331. echo.                                    !n!:%%a))
  332. setlocal disabledelayedexpansion
  333. :lable
  334. if /i "%3" neq "a" echo                                      %3
  335. if /i "%4" neq "b" echo                                      %4
  336. if /i "%5" neq "c" echo                                      %5
  337. if /i "%6" neq "d" echo                                      %6
  338. if /i "%7" neq "e" echo                                      %7
  339. if /i "%8" neq "f" echo                                      %8
  340. if /i "%9" neq "g" echo                                      %9
  341. ::下面可以传递17个值,1-9,不用,10-14只用第一组shift,15-17,用一二组,每组下面是取值的地方
  342. shift /0&shift /1&shift /2&shift /3&shift /4
  343. ::shift /5&shift /6&shift /7      
  344. echo.&echo.                                 %9
  345. echo.&set pa=<nul&set /p pa=%8
  346. if defined pa ( set "pa=%pa:"=%"&goto :xx)else ( call %7 "不能为空值,请重操作")
  347. :xx
  348. if /i "%pa%"=="0" call :soft
  349. if /i "%pa%"=="z" call %6
  350. if /i "%dav%"=="1" call %5 "%pa%"
  351. for /f "tokens=1-2 delims=:" %%a in ('findstr /b "%pa%:" %dp%\st\2.txt') do (set pa=%%b)
  352. call %5 "%pa%"
  353. :delyy
  354. ::删除制作完成后的原文件
  355. cls&echo.&echo                           %batname%-%2
  356. echo.&echo.                                     %1
  357. echo.&echo.                       要删除按"y",不删除按"n"或8秒后自动返回主菜单
  358. echo.&choice /c yn /t 8 /d n
  359. if errorlevel 2 call :soft
  360. if errorlevel 1 goto :delold
  361. :delold
  362. set /p yn=请输入"y"确认删除,否则直返回主菜单:
  363. if /i "%yn%" equ "y" ( rd /s/q "%paa%"&call :soft)else ( call :soft)
  364. :quan
  365. ::call过来的%1,是要导出到的位置,%2为是否显示
  366. echo @echo off>%1
  367. echo Mode con cols=88 lines=26 >>%1
  368. echo color a >>%1
  369. echo cd /d %%~dp0 >>%1
  370. echo %%1 %%2>>%1
  371. echo ver^|find "5."^>nul^&^&goto :st>>%1
  372. echo mshta vbscript:createobject("shell.application").shellexecute("%%~s0","goto :st","","runas",%2)(window.close)^&goto :eof>>%1
  373. echo :st>>%1
  374. goto :eof
  375. :settings
  376. ::7z设置
  377. if exist %~dp0soft\settings.ini del /f /s /q %~dp0soft\settings.ini
  378. echo [Main] >soft\settings.ini
  379. echo Lang=Chinese Simplified >>soft\settings.ini
  380. echo XPos=658 >>soft\settings.ini
  381. echo YPos=282 >>soft\settings.ini
  382. echo UseUPX=0 >>soft\settings.ini
  383. echo UPXCommands=--best --all-methods >>soft\settings.ini
  384. echo UseDefaultSFXMod=1 >>soft\settings.ini
  385. if "%PROCESSOR_IDENTIFIER:~0,3%" == "x86" ( echo DefaultSFXMod=7zsd_LZMA2 >>soft\settings.ini)else ( echo DefaultSFXMod=7zsd_LZMA2_x64 >>soft\settings.ini)
  386. echo AutoSelectModule=0 >>soft\settings.ini
  387. echo IgnoreEmptyVersData=0 >>soft\settings.ini
  388. echo AutoDetermineSFXPath=0 >>soft\settings.ini
  389. echo OverwriteSFX=0 >>soft\settings.ini
  390. echo [Mode] >>soft\settings.ini
  391. echo RegMode=0 >>soft\settings.ini
  392. echo [7-Zip] >>soft\settings.ini
  393. echo Path=3rdParty\7z\7z.exe >>soft\settings.ini
  394. echo Level=Ultra >>soft\settings.ini
  395. echo Method=LZMA2 >>soft\settings.ini
  396. echo Dictionary=64 MB >>soft\settings.ini
  397. echo BlockSize=Solid >>soft\settings.ini
  398. echo [MRUList] >>soft\settings.ini
  399. echo 1=%dp%\st\ini.txt >>soft\settings.ini
  400. ::添加启动7z程序bat
  401. if exist %~dp0soft\7z.bat del /f /s /q %~dp0soft\7z.bat
  402. call :quan soft\7z.bat 0
  403. echo tasklist /nh^|find /i "7zSFXBuilder.exe"^&^&taskkill /f /im "7zSFXBuilder.exe">>soft\7z.bat
  404. echo if ERRORLEVEL 0 (start 7zSFXBuilder.exe %dp%\st\ini.txt)>>soft\7z.bat
  405. echo exit /b>>soft\7z.bat
  406. call soft\shortcut.exe /f:"%AppData%\Microsoft\Windows\Start Menu\Programs\set.lnk" /a:c /t:"%~dp0set.bat"
  407. call :soft
  408. :ctemp
  409. ::清理系统垃圾
  410. call :quan %dp%\clearn.bat 0
  411. echo del /f /s /q /a "%%systemdrive%%\*.dmp" >>%dp%\clearn.bat
  412. echo del /f /s /q /a "%%systemdrive%%\*.tmp" >>%dp%\clearn.bat
  413. echo del /f /s /q /a "%%systemdrive%%\*._mp" >>%dp%\clearn.bat
  414. echo del /f /s /q /a "%%systemdrive%%\*.log" >>%dp%\clearn.bat
  415. echo del /f /s /q /a "%%systemdrive%%\*.gid" >>%dp%\clearn.bat
  416. echo del /f /s /q /a "%%systemdrive%%\*.chk" >>%dp%\clearn.bat
  417. echo del /f /s /q /a "%%systemdrive%%\*.old" >>%dp%\clearn.bat
  418. echo del /f /s /q /a "%%systemdrive%%\*.bak" >>%dp%\clearn.bat
  419. echo del /f /s /q /a "%%systemdrive%%\*.query" >>%dp%\clearn.bat
  420. echo del /f /s /q /a "%%SystemRoot%%\inf\*.pnf" >>%dp%\clearn.bat
  421. echo del /f /s /q /a "%%SystemRoot%%\Driver Cache\*.pnf" >>%dp%\clearn.bat
  422. echo del /f /s /q /a "%%SystemRoot%%\Driver Cache\InfCache.1" >>%dp%\clearn.bat
  423. echo del /f /s /q /a "%%SystemRoot%%\system32\drivers\*.pnf" >>%dp%\clearn.bat
  424. echo del /f /s /q /a "%%SystemRoot%%\system32\drivers\InfCache.1" >>%dp%\clearn.bat
  425. echo del /f /s /q /a "%%SystemRoot%%\inf\InfCache.1"  >>%dp%\clearn.bat
  426. echo del /f /s /q /a "%%SystemRoot%%\prefetch\*.*" >>%dp%\clearn.bat
  427. echo del /f /s /q /a "%%SystemRoot%%\minidump\*.*" >>%dp%\clearn.bat
  428. echo del /f /s /q /a "%%userprofile%%\local settings\temp\*.*" >>%dp%\clearn.bat
  429. echo del /f /s /q /a "%%userprofile%%\Locals~1\Tempor~1\*.*" >>%dp%\clearn.bat
  430. echo del /f /s /q /a "%%userprofile%%\Locals~1\Temp\*.*" >>%dp%\clearn.bat
  431. echo del /f /s /q /a "%%userprofile%%\recent\*.*" >>%dp%\clearn.bat
  432. echo del /f /s /q /a "%%HomePath%%\..\IconCache.db" >>%dp%\clearn.bat
  433. echo del /f /s /q /a "%%userprofile%%\cookies\*.*" >>%dp%\clearn.bat
  434. echo del /f /s /q /a "%%userprofile%%\local settings\temporary internet files\*.*" >>%dp%\clearn.bat
  435. echo rd /s /q "%%SystemRoot%%\Downloaded Program Files" >>%dp%\clearn.bat
  436. echo rd /s /q "%%SystemRoot%%\Downloaded Program Files" >>%dp%\clearn.bat
  437. echo rd /s /q "%%SystemRoot%%\Offline Web Pages" >>%dp%\clearn.bat
  438. echo rd /s /q "%%SystemRoot%%\Connection Wizard" >>%dp%\clearn.bat
  439. echo rd /s /q "%%SystemRoot%%\SoftwareDistribution\Download" >>%dp%\clearn.bat
  440. echo rd /s /q "%%SystemRoot%%\Assembly" >>%dp%\clearn.bat
  441. echo rd /s /q "%%SystemRoot%%\Help" >>%dp%\clearn.bat
  442. echo rd /s /q "%%SystemRoot%%\system32\ReinstallBackups" >>%dp%\clearn.bat
  443. echo rd /s /q "%%SystemRoot%%\temp" ^& md "%%SystemRoot%%\temp" >>%dp%\clearn.bat
  444. echo rd /s /q "%%SystemRoot%%\$hf_mig$" >>%dp%\clearn.bat
  445. echo reg delete "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" /va /f >>%dp%\clearn.bat
  446. echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache ^>%temp%\cleantmp.txt >>%dp%\clearn.bat
  447. echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
  448. echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
  449. echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v NetHood ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
  450. echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Recent ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
  451. echo for /f "tokens=3*" %%%%a in (%%temp%%\cleantmp.txt) do ( for /d %%%%i in ("%%%%a %%%%b\*.*") do ( rd /s /q "%%%%i")^&del /f /s /q "%%%%a %%%%b\*.*") >>%dp%\clearn.bat
  452. echo dir "%%SystemRoot%%\$NtUninstall*" /a:d /b ^>%%temp%%\update.txt >>%dp%\clearn.bat
  453. echo for /f %%%%i in (%%temp%%\update.txt) do (rd %%SystemRoot%%\%%%%i /s /q )>>%dp%\clearn.bat
  454. echo dir "%%SystemRoot%%\inf\*.*" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
  455. echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemRoot%%\inf\%%%%a") >>%dp%\clearn.bat
  456. echo dir "%%SystemDrive%%\found.???" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
  457. echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemDrive%%\inf\%%%%a") >>%dp%\clearn.bat
  458. echo dir "%%SystemRoot%%\$*$" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
  459. echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemRoot%%\%%%%a") >>%dp%\clearn.bat
  460. echo for /f "delims=" %%%%a in ('dir/ad/b "%%temp%%"') do ( rd /s/q "%%temp%%\%%%%a")^&del /s/f/q  %%temp%%\*>>%dp%\clearn.bat
  461. echo for /f "delims=" %%%%a in ('dir/ad/b "%%tmp%%"') do ( rd /s/q "%%tmp%%\%%%%a")^&del /s/f/q  %%tmp%%\*>>%dp%\clearn.bat
  462. echo exit /b>>%dp%\clearn.bat
  463. call %dp%\clearn.bat&call :soft
复制代码
1

评分人数

    • 1055367558: 虽说现在已经没用了,,但还是鼓励下楼主技术 + 1

这玩笑开大了吧,开局一张图内容全靠编,东西那,醉了
这么好的论坛你上哪找,运行测试环境为6.1.7601-64
注:请遵守互联网信息安全,勿用于非法用途

TOP

回复 2# /zhqsystem/zhq


    昨天有点事,没发

TOP

回复 3# yunyan100


    麻烦过长的代码用[code][/code]编一下,,方便别人

TOP

回复 4# 1055367558


    我之前发的用code发过,不能成功,不知道是不是太多行,现在少了约200行,可以发了

TOP

回复 5# yunyan100


    表示3000行没问题

TOP

在吾爱破解网上看到了你的大作,很荣幸
开开心心每天学习,努力做个好学生!

TOP

多用点for可以变短点

TOP

回复 8# hk7777777


    这个是的,有道理,我来改

TOP

返回列表