标题: [其他] 发个批处理功能,在这里算是得到帮助过 [打印本页]
作者: yunyan100 时间: 2017-10-20 22:58 标题: 发个批处理功能,在这里算是得到帮助过
有更新了,地址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),同时改进了一些功能,也增加延时自动功能- @echo off&color a&Mode con cols=88 lines=26
- set batname=批处理(自动化)多功能组合&set batver=Ver.3.2&set battime=(2017.11.7)
- set pp=E:\files\7zsoft&set dp=%temp%\1temp
- rd /s/q %dp%&md %dp%&md %dp%\file&md %dp%\st&if not exist %pp% md %pp%
- set winrar=soft\3rdParty\WinRAR\WinRAR.exe&set szz=soft\3rdParty\7z\7zG.exe
- :: 说明:暂无问题发现
- :soft
- title %batname%%batver%%battime% by 零点三点零
- 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
- 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%
- cls&echo.&echo.&cd /d "%~dp0"
- echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- echo ☆ ☆
- echo ★ %batname% - %batver% ★
- echo ☆ ☆
- echo ★ W.完整封装单文件 1.批量转空值文件 ★
- echo ☆ M.编辑启动文件 2.CHM文件反编译 ☆
- echo ★ I.重置程序信息 3.Reg转换为Bat ★
- echo ☆ R.启动7z软件制作 4.EXE文件信息定制 ☆
- echo ★ N.制作程序多ICO 5.批量压缩文件夹 ★
- echo ☆ T.添加管理员权限 6.Bitlocker操作 ☆
- echo ★ F.启动Winrar制作 ★
- echo ☆ A.封装文件夹查看 ☆
- echo ★ S.设置封装程序 ★
- echo ☆ Z.清理垃圾及退出 0.清理系统垃圾(隐形) ☆
- echo ★ ★
- echo ☆ 当前时间:%date:~0,4%年%date:~5,2%月%date:~8,2%日 星期%date:~-1,1% %time:~0,2%时%time:~3,2%分 ☆
- echo ★ ★
- echo ☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
- echo by:1145846856
- echo. %1
- echo.........................................................................................
- echo.
- @set /p start=请选择 (菜单字符) 后按回车键:
- if /i "%start%"=="w" ( call :copyfile
- )else (if /i "%start%"=="m" ( start soft\notepad.exe %dp%\file\a.bat&call :soft
- )else (if /i "%start%"=="i" ( call :fileiic
- )else (if /i "%start%"=="r" ( call soft\7z.bat&call :soft
- )else (if /i "%start%"=="n" ( call :iico
- )else (if /i "%start%"=="t" ( call :de
- )else (if /i "%start%"=="f" ( call :winrar
- )else (if /i "%start%"=="a" ( call :ffname
- )else (if /i "%start%"=="s" ( call :settings
- )else (if /i "%start%"=="1" ( call :onlysoft
- )else (if /i "%start%"=="2" ( call :bchm
- )else (if /i "%start%"=="3" ( call :vbr
- )else (if /i "%start%"=="4" ( call :inff&call :soft
- )else (if /i "%start%"=="5" ( call :yasuo
- )else (if /i "%start%"=="6" ( call :bitlock
- )else (if /i "%start%"=="z" ( rd /s/q %dp%&rd /s/q %temp%\sun&exit
- )else (if /i "%start%"=="0" ( call :ctemp
- )else ( call :soft "操作错误,请重操作")))))))))))))))))
-
- :copyfile
- ::复制文件,去掉引号
- rd /s/q %dp%\file&md %dp%\file&cls
- call :list 复制封装文件 1 a b c d e f g :dcc :soft :copyfile "请拖入文件路径或exe文件(0,z,返回主菜单):" %1
- :dcc
- set ne=%~x1&set paa=%pa%
- if /i "%ne%"==".exe" xcopy "%pa%" "%dp%\file"&&call :fileiic
- dir/ad "%pa%" >nul 2>nul&&call :copyff||call :copyfile "非路径,exe文件,重置"
- :copyff
- ROBOCOPY "%pa%" * "%dp%\file" /s&call :fileiic
-
- :fileiic
- ::获取程序信息,下面部份无法在本文件执行,只能生成bat由本文件call调用
- echo var objShell = new ActiveXObject('Shell.Application'); >%dp%\css.bat
- echo var m = WSH.StdIn.ReadLine().match(/^^(.+)\\([^^\\]+\.[^^\.]+)$/i); >>%dp%\css.bat
- echo try { >>%dp%\css.bat
- echo var objFolder = objShell.NameSpace(m[1]); >>%dp%\css.bat
- echo var objItem = objFolder.ParseName(m[2]); >>%dp%\css.bat
- echo for (var i=0; i^<287; i++){ >>%dp%\css.bat
- echo var info = objFolder.GetDetailsOf(objItem, i); >>%dp%\css.bat
- echo if(info)WSH.echo(objFolder.GetDetailsOf(null, i)+":"+info); >>%dp%\css.bat
- echo } >>%dp%\css.bat
- echo }catch(e){WSH.echo("路径或文件名无效!");} >>%dp%\css.bat
- del /q/s/f %dp%\st\1.txt&cls
- call :list 获取版本信息 0 a b c d e f g :icc :copyfile :fileiic "请选序号或直接拖入(z,返回上级,0,返回主菜单):" %1
- :icc
- set ee=%~nx1&set ne=%~n1
- call "%~dp0soft\ico.exe" "%pa%" 1 %dp%\st\0.ico
- echo %pa%|cscript -nologo -e:jscript %dp%\css.bat >>%dp%\st\1.txt
- if /i "%start%" equ "i" ( call :info)else ( call :bty)
-
- :bty
- ::设置程序是否为单32位或64位,双位即为32和64位
- call :list 启动软件设置 1 1.单位程序 2.双位程序 c d e f g :btyy :fileiic :bty "设置程序(含32和64位)(1,2,z返回上级,0返回主菜单):" %1
- :btyy
- set bit=%1
- if /i %bit% equ "1" ( call :kky)else ( if /i %bit% equ "2" ( call :kky)else ( call :bty "操作错误,请重操作"))
- :kky
- ::启动程序名
- if /i %bit% equ "1" ( call :list 运行程序设定 0 a b c d e f g :gfn :bty :kky "请拖入或选择(z,返回上级,0返回主菜单):" %1
- )else ( if /i %bit% equ "2" ( call :list 运行程序设定 0 a b c d e f g :gfn :bty :kky "请拖入或选择32位(z,返回上级,0返回主菜单):" %1
- )else ( call :kky "操作错误,请重操作"))
- :gfn
- set ee=%~nx1&set ne=%~n1
- if /i %bit%=="1" ( goto :na)else ( call :kkn)
- :kkn
- 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 "操作错误,请重操作")
- :gfn64
- set ee64=%~nx1&goto :na
-
- :na
- ::a.bat启动文件
- echo @echo off>%dp%\file\a.bat
- echo ::公共注册内容,如有问题,尝试开启管理员权限>>%dp%\file\a.bat
- echo ::reg add "HKCU\Software\...." /v "..." /t REG_DWORD /d 0 /f>>%dp%\file\a.bat
- if /i %bit% equ "2" echo if /i "%%PROCESSOR_IDENTIFIER:~0,3%%" == "x86" ( >>%dp%\file\a.bat
- echo tasklist^|findstr /i "%ee%"^&taskkill /f /im "%ee%">>%dp%\file\a.bat
- echo call "%ee%">>%dp%\file\a.bat
- echo tasklist^|findstr /i "%ee%"^&taskkill /f /im "%ee%">>%dp%\file\a.bat
- if /i %bit% equ "2" echo )else ( >>%dp%\file\a.bat
- if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&taskkill /f /im "%ee64%">>%dp%\file\a.bat
- if /i %bit% equ "2" echo call "%ee64%">>%dp%\file\a.bat
- if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&taskkill /f /im "%ee64%")>>%dp%\file\a.bat
- echo :a>>%dp%\file\a.bat
- echo ::公共删除注内容>>%dp%\file\a.bat
- echo ping 127.1 -n 2 ^>nul>>%dp%\file\a.bat
- if /i %bit% equ "2" echo if /i "%%PROCESSOR_IDENTIFIER:~0,3%%" == "x86" ( >>%dp%\file\a.bat
- echo tasklist^|findstr /i "%ee%"^&^&goto :a^|^|goto :b>>%dp%\file\a.bat
- if /i %bit% equ "2" echo )else ( >>%dp%\file\a.bat
- if /i %bit% equ "2" echo tasklist^|findstr /i "%ee64%"^&^&goto :a^|^|goto :b)>>%dp%\file\a.bat
- echo :b>>%dp%\file\a.bat
- echo ::reg delete "HKCU\Software....." /f>>%dp%\file\a.bat
- echo ::reg delete "HKCU\Software\WOW6432Node\....." /f>>%dp%\file\a.bat
- echo cd..^&rd /s/q "%%~dp0">>%dp%\file\a.bat
- echo del /q/s/f "%%~f0" 2>nul>>%dp%\file\a.bat
- echo exit>>%dp%\file\a.bat&call :info
-
- :info
- ::下面7zSFX资料ini.txt
- echo ;!@Install@!UTF-8!>%dp%\st\ini.txt
- echo InstallPath="%%Temp%%\\sun\\%ne%">>%dp%\st\ini.txt
- echo GUIMode="2">>%dp%\st\ini.txt
- echo RunProgram="hidcon:\"a.bat\"">>%dp%\st\ini.txt
- echo ;Config file generated by 7z SFX Builder v2.1. (https://www.52pojie.cn/thread-656608-1-1.html)>>%dp%\st\ini.txt
- echo ;!@InstallEnd@!>>%dp%\st\ini.txt
- echo 7zSFXBuilder_SFXName=%pp%\%ee%>>%dp%\st\ini.txt
- echo 7zSFXBuilder_SFXIcon=%dp%\st\0.ico>>%dp%\st\ini.txt
- echo 7zSFXBuilder_UseDefMod=7zsd_LZMA2>>%dp%\st\ini.txt
- echo 7zSFXBuilder_SFXFile_1=%dp%\file\*>>%dp%\st\ini.txt
- echo 7zSFXBuilder_7Zip_Level=Ultra>>%dp%\st\ini.txt
- echo 7zSFXBuilder_7Zip_Method=LZMA2>>%dp%\st\ini.txt
- echo 7zSFXBuilder_7Zip_Dictionary=64 MB>>%dp%\st\ini.txt
- echo 7zSFXBuilder_7Zip_BlockSize=Solid>>%dp%\st\ini.txt
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件版本" %dp%\st\1.txt') do (
- echo 7zSFXBuilder_Res_FileVersion=%%b>>%dp%\st\ini.txt
- echo 7zSFXBuilder_Res_ProductVersion=%%b>>%dp%\st\ini.txt)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件说明" %dp%\st\1.txt') do (
- echo 7zSFXBuilder_Res_FileDescription=%%b>>%dp%\st\ini.txt)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /r "名称" %dp%\st\1.txt') do (
- if /i "%%a" =="名称" echo 7zSFXBuilder_Res_ProductName=%%b>>%dp%\st\ini.txt)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件名" %dp%\st\1.txt') do (
- echo 7zSFXBuilder_Res_OriginalFileName=%%b>>%dp%\st\ini.txt)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "公司" %dp%\st\1.txt') do (
- echo 7zSFXBuilder_Res_CompanyName=%%b>>%dp%\st\ini.txt)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "版权" %dp%\st\1.txt') do (
- echo 7zSFXBuilder_Res_LegalCopyright=%%b>>%dp%\st\ini.txt)
- ::下面为winrar调用
- echo Path=%%temp%%\sun\%ne%>%dp%\st\win.txt&echo Setup=run.vbs>>%dp%\st\win.txt
- echo Silent=1 >>%dp%\st\win.txt&echo Overwrite=1 >>%dp%\st\win.txt
- if /i "%start%" equ "i" ( call :soft)else ( call :win7z)
-
- :win7z
- call :list 封装方式先定 1 1.选择7zSFX 2.选择Winrar c d e f g :win7zz :kky :win7z "请选择(z返回上级,0返回主菜单):" %1
- :win7zz
- if /i "%pa%" equ "1" ( call :7zinf)else (if /i "%pa%" equ "2" ( call :winin)else ( call :win7z "操作错误,请重操作"))
-
- :7zinf
- if exist "%pp%\%ee%" del /s/q "%pp%\%ee%"
- cls&if /i "%start%" equ "w" call soft\7z.bat
- call :delyy 删除封装完成原文件 封装完成原文件
-
- :winrar
- ::直接调用Winrar时此处选择程序
- call :list Winrar运行程序 0 a b c d e f g :wgfn :kky :kky "请拖入或选择(z,返回上级,0返回主菜单):" %1
- :wgfn
- set ee=%~nx1&set ne=%~n1&call :winin
- :winin
- echo CreateObject("WScript.Shell").Run "cmd /c .\a.bat",0 >%dp%\file\run.vbs
- if exist "%pp%\%ee%" del /s/q "%pp%\%ee%"
- cls&%winrar% a -m5 -s -r -sfx -o+ -z%dp%\st\win.txt -iicon%dp%\st\0.ico "%pp%\%ee%" -ep1 "%dp%\file\"
- call :inff&if /i "%start%" equ "f" call :soft
- call :delyy 删除封装完成原文件 封装完成原文件
-
- :inff
- ::版本信息设置
- if exist "soft\inf\setting.ini" del /s/q "soft\inf\setting.ini"&cls
- echo [setting] >soft\inf\setting.ini
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件版本" %dp%\st\1.txt') do (
- echo 文件版本1=%%b >>soft\inf\setting.ini
- echo 产品版本=%%b >>soft\inf\setting.ini)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件说明" %dp%\st\1.txt') do (
- echo 描述=%%b >>soft\inf\setting.ini)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /r "名称" %dp%\st\1.txt') do (
- if /i "%%a" =="名称" echo 产品名称=%%b >>soft\inf\setting.ini)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "文件名" %dp%\st\1.txt') do (
- echo 源文件名=%%b >>soft\inf\setting.ini)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "公司" %dp%\st\1.txt') do (
- echo 公司=%%b >>soft\inf\setting.ini)
- for /f "tokens=1-2 delims=:" %%a in ('findstr /l "版权" %dp%\st\1.txt') do (
- echo 版权=%%b >>soft\inf\setting.ini)
- echo 语言=中文 >>soft\inf\setting.ini
- tasklist /nh|find /i "inf.exe"&&taskkill /f /im "inf.exe"
- cls&if ERRORLEVEL 0 (call soft\inf\inf.exe)&del /s/q "%pp%\*.bak"&goto :eof
-
- :iico
- ::多ICO图片制作
- if not exist %dp%\file\main.exe copy soft\au3\main.exe %dp%\file
- if not exist %dp%\file\ico md %dp%\file\ico&cls
- call :list 多ICO图片制作 0 a b c d e f g :iicoo :soft :iico "多ico制作请拖入或选取文件(0,z,返回主菜单):" %1
- :iicoo
- set /p in=请输入ICO文件名:
- set inn=%in%.ico&set ico=%pa%
- for /f "tokens=1-2 delims=:" %%a in ('findstr /b /i "%ico%" %dp%\st\2.txt') do (set ico=%%b)
- call soft\ico.exe "%ico%" 1 %dp%\file\ico\%inn%&call :iico
-
- :ffname
- ::需查看文件夹
- call :list 进入文件夹 1 1.封装保存文件夹 2.封装运行文件夹 3.临时1Temp文件夹 4.临时file文件夹 5.本程序文件夹 6.编辑SET.bat g :ffnamee :soft :ffname "选择文件夹序号(0,z,反回主菜单):" %1
- :ffnamee
- if /i "%pa%"=="1" ( start /i "" "%pp%"&call :soft
- )else (if /i "%pa%"=="2" ( start /i "" "%temp%\sun"&call :soft
- )else (if /i "%pa%"=="3" ( start /i "" "%dp%"&call :soft
- )else (if /i "%pa%"=="4" ( start /i "" "%dp%\file"&call :soft
- )else (if /i "%pa%"=="5" ( start /i "" "%~dp0"&call :soft
- )else (if /i "%pa%"=="6" ( start soft\notepad.exe set.bat&call :soft
- )else ( call :ffname "操作错误,请重操作"))))))
-
- :de
- ::权限添加
- if exist %dp%\file\a.bat findstr /v "@echo" "%dp%\file\a.bat">%dp%\st\b.bat
- call :quan %dp%\file\a.bat 0
- type %dp%\st\b.bat >>%dp%\file\a.bat&call :soft
-
- :onlysoft
- ::批量制作空值文件
- del /s/q %dp%\st\s.txt&rd /s/q %dp%\file&md %dp%\file&cls
- call :list 空值文件制作 1 a b c d e f g :nasoft :soft :onlysoft "请直接拖执行文件夹按回车(0,z,返回主菜单):" %1
- :nasoft
- dir/ad "%pa%" >nul 2>nul&&cd /d "%pa%"||call :onlysoft "不是路径,请重操作"
- cls&set paa=%pa%&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. 正在写入中......
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d /s "*"') do ( echo %%~i >>%dp%\st\s.txt)
- set "src=%pa%"&set "dst=%dp%\file"
- (for /f "delims=" %%a in (%dp%\st\s.txt) do ( set "str=%%a"
- echo,!str:%src%=%dst%! ))>%dp%\#
- move %dp%\# %dp%\st\s.txt
- cls&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. 已写入完成......
- for /f "delims=" %%a in (%dp%\st\s.txt) do ( call :vcn "%%a")
- setlocal disabledelayedexpansion
- cls&start explorer.exe %dp%\file&call :delyy 删除复制完成原文件 已被复制原文件
- :vcn
- set vcnn=%~dp1&set vdnn=%~nx1&md "%vcnn%"
- echo .>"%vcnn%%vdnn%"&goto :eof
-
- :bchm
- call :list CHM文件反编译 1 a b c d e f g :zz :soft :bchm "要反编的CHM电子书拖进来(0,z,返回主菜单):" %1
- :zz
- set ne=%~x1
- if /i "%ne%"==".chm" ( call :chm "%pa%")else ( call :bchm "非chm文件,请重操作")
- :chm
- set dnn=%~n1
- %szz% x "%pa%" -o"%dp%\file\%dnn%"
- del /f /s /q "%dp%\file\%dnn%\*$*.*"&del /f /s /q "%dp%\file\%dnn%\*#*.*"
- for /f %%i in ('dir /ad /b "%dp%\file\%dnn%\$*"') do rd /s /q "%dp%\file\%dnn%\%%i"
- start explorer.exe %dp%\file&call :soft
-
- :vbr
- ::转换vbs bat
- call :list 将REG转为BAT 1 a b c d e f g :vn :soft :vbr "请拖入需转换文件(0,返回主菜单):" %1
- :vn
- set ne=%~x1&set ee=%~nx1&set vcnn=%~dp1&set vdnn=%~n1.bat
- if /i "%ne%"==".reg" ( copy "%pa%" "%dp%"\st&del /q/s "%pa%"
- call soft\Reg2Bat.vbs "%dp%\st\%ee%"
- start soft\notepad.exe "%dp%\st\%vdnn%"&call :soft)else ( call :vbr "非REG文件,请重操作")
-
- :yasuo
- ::批量压缩
- call :list 批量压缩路径 1 a b c d e f g :yass :soft :yasuo "请拖入压缩路径(0,z,返回主菜单):" %1
- :yass
- dir/ad "%pa%" >nul 2>nul&&set paa=%pa%||call :yasuo "不是路径,请重操作"
- call :yalu
- :yalu
- call :list 批量压缩路径 1 a b c d e f g :yaluu :yasuo :yalu "设置保存路径(0,z返回主菜单):" %1
- :yaluu
- dir/ad "%pa%" >nul 2>nul&&set inpa=%pa%||call :yalu "不是路径,请重操作"
- call :yafang
- :yafang
- call :list 批量压缩方式 1 1.选择7z压缩 2.选择Winrar压缩 c d e f g :fangshi :yalu :yafang "请选择(1,7z,2,Winrar,0,返回主菜单):" %1
- :fangshi
- if /i "%pa%"=="1" ( cls&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. 正在压缩中......
- (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.
- echo. 正在压缩中......
- (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 "操作错误,请重操作"))
- :delfile
- call :delyy 删除已被压缩原文件 已被压缩原文件
-
- :bitlock
- ::系统bitlocker操作
- call :quan %dp%\bitlocker.bat 1
- echo call :dy>>%dp%\bitlocker.bat
- echo :dy>>%dp%\bitlocker.bat&echo cls^&echo.>>%dp%\bitlocker.bat
- echo echo. %batname%-Bitlocker设置管理>>%dp%\bitlocker.bat
- echo echo.>>%dp%\bitlocker.bat
- echo echo. %%1>>%dp%\bitlocker.bat
- echo echo.^&if /i "%%pa%%" equ "" set pa=k:>>%dp%\bitlocker.bat
- echo if /i "%%2"=="1" call :dd>>%dp%\bitlocker.bat
- echo if /i "%%2"=="2" call :unlock>>%dp%\bitlocker.bat
- echo if /i "%%2"=="3" call :milock>>%dp%\bitlocker.bat
- echo set /p inpa=当前分区是:"%%pa%%",请输入分区字母,不更改直接回车: >>%dp%\bitlocker.bat
- echo if /i "%%inpa%%"=="" ( call :dd)else ( set pa=%%inpa%%:^& call :dd)>>%dp%\bitlocker.bat
- echo :dd>>%dp%\bitlocker.bat
- echo echo.处理分区:"%%pa%%": 1.密码解密 2.密钥解密 3.恢复加密 4.添加加密 5.修改密码 6.清除加密>>%dp%\bitlocker.bat
- echo echo.^&set /p na=请选择解密还是加密(0返回上级,1,2,3,4,5,6):>>%dp%\bitlocker.bat
- 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
- echo :unlock>>%dp%\bitlocker.bat
- 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
- echo :milock>>%dp%\bitlocker.bat
- echo set /p xx=输入密钥:>>%dp%\bitlocker.bat
- 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
- echo :lock>>%dp%\bitlocker.bat
- echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -lock -fd %%pa%%^&^&call :dy "加密成功"^|^|call :dy "操作错误" 1>>%dp%\bitlocker.bat
- echo :nlock>>%dp%\bitlocker.bat
- 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
- 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
- echo :npw>>%dp%\bitlocker.bat
- echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -changepassword %%pa%%^&^&call :dy "修改密码成功"^|^|call :dy "操作错误" 1 >>%dp%\bitlocker.bat
- echo :nnlock>>%dp%\bitlocker.bat
- echo dir/ad "%%pa%%" ^>nul 2^>nul^&^&%%systemroot%%\system32\Manage-bde.exe -off %%pa%%^&^&call :dy "清除加密成功"^|^|call :dy "操作错误" 1>>%dp%\bitlocker.bat
- call %dp%\bitlocker.bat&call :soft
-
- :list
- :: %1名,%2(0,显,1不显)是否显(生成)exe列表,a到g为临时菜单名,%10转回下级,%11返回上级,%12错误返回处,%13选择名,%14错误值
- cls&echo.&echo %batname%-%1
- ::生成并列出exe程序表
- set dav=%2
- if /i "%dav%"=="1" goto :lable
- if exist %dp%\st\2.txt del /s/q %dp%\st\2.txt
- cls&echo.&echo %batname%-%1
- setlocal enabledelayedexpansion
- set n=0
- (for /f "delims=" %%a in ('dir /b "%dp%\file\*.exe"') do ( set /a n%%=99&set /a n+=1
- echo !n!:%dp%\file\%%a>>%dp%\st\2.txt
- echo. !n!:%%a))
- setlocal disabledelayedexpansion
- :lable
- if /i "%3" neq "a" echo %3
- if /i "%4" neq "b" echo %4
- if /i "%5" neq "c" echo %5
- if /i "%6" neq "d" echo %6
- if /i "%7" neq "e" echo %7
- if /i "%8" neq "f" echo %8
- if /i "%9" neq "g" echo %9
- ::下面可以传递17个值,1-9,不用,10-14只用第一组shift,15-17,用一二组,每组下面是取值的地方
- shift /0&shift /1&shift /2&shift /3&shift /4
- ::shift /5&shift /6&shift /7
- echo.&echo. %9
- echo.&set pa=<nul&set /p pa=%8
- if defined pa ( set "pa=%pa:"=%"&goto :xx)else ( call %7 "不能为空值,请重操作")
- :xx
- if /i "%pa%"=="0" call :soft
- if /i "%pa%"=="z" call %6
- if /i "%dav%"=="1" call %5 "%pa%"
- for /f "tokens=1-2 delims=:" %%a in ('findstr /b "%pa%:" %dp%\st\2.txt') do (set pa=%%b)
- call %5 "%pa%"
-
- :delyy
- ::删除制作完成后的原文件
- cls&echo.&echo %batname%-%2
- echo.&echo. %1
- echo.&echo. 要删除按"y",不删除按"n"或8秒后自动返回主菜单
- echo.&choice /c yn /t 8 /d n
- if errorlevel 2 call :soft
- if errorlevel 1 goto :delold
- :delold
- set /p yn=请输入"y"确认删除,否则直返回主菜单:
- if /i "%yn%" equ "y" ( rd /s/q "%paa%"&call :soft)else ( call :soft)
-
- :quan
- ::call过来的%1,是要导出到的位置,%2为是否显示
- echo @echo off>%1
- echo Mode con cols=88 lines=26 >>%1
- echo color a >>%1
- echo cd /d %%~dp0 >>%1
- echo %%1 %%2>>%1
- echo ver^|find "5."^>nul^&^&goto :st>>%1
- echo mshta vbscript:createobject("shell.application").shellexecute("%%~s0","goto :st","","runas",%2)(window.close)^&goto :eof>>%1
- echo :st>>%1
- goto :eof
-
- :settings
- ::7z设置
- if exist %~dp0soft\settings.ini del /f /s /q %~dp0soft\settings.ini
- echo [Main] >soft\settings.ini
- echo Lang=Chinese Simplified >>soft\settings.ini
- echo XPos=658 >>soft\settings.ini
- echo YPos=282 >>soft\settings.ini
- echo UseUPX=0 >>soft\settings.ini
- echo UPXCommands=--best --all-methods >>soft\settings.ini
- echo UseDefaultSFXMod=1 >>soft\settings.ini
- if "%PROCESSOR_IDENTIFIER:~0,3%" == "x86" ( echo DefaultSFXMod=7zsd_LZMA2 >>soft\settings.ini)else ( echo DefaultSFXMod=7zsd_LZMA2_x64 >>soft\settings.ini)
- echo AutoSelectModule=0 >>soft\settings.ini
- echo IgnoreEmptyVersData=0 >>soft\settings.ini
- echo AutoDetermineSFXPath=0 >>soft\settings.ini
- echo OverwriteSFX=0 >>soft\settings.ini
- echo [Mode] >>soft\settings.ini
- echo RegMode=0 >>soft\settings.ini
- echo [7-Zip] >>soft\settings.ini
- echo Path=3rdParty\7z\7z.exe >>soft\settings.ini
- echo Level=Ultra >>soft\settings.ini
- echo Method=LZMA2 >>soft\settings.ini
- echo Dictionary=64 MB >>soft\settings.ini
- echo BlockSize=Solid >>soft\settings.ini
- echo [MRUList] >>soft\settings.ini
- echo 1=%dp%\st\ini.txt >>soft\settings.ini
- ::添加启动7z程序bat
- if exist %~dp0soft\7z.bat del /f /s /q %~dp0soft\7z.bat
- call :quan soft\7z.bat 0
- echo tasklist /nh^|find /i "7zSFXBuilder.exe"^&^&taskkill /f /im "7zSFXBuilder.exe">>soft\7z.bat
- echo if ERRORLEVEL 0 (start 7zSFXBuilder.exe %dp%\st\ini.txt)>>soft\7z.bat
- echo exit /b>>soft\7z.bat
- call soft\shortcut.exe /f:"%AppData%\Microsoft\Windows\Start Menu\Programs\set.lnk" /a:c /t:"%~dp0set.bat"
- call :soft
-
- :ctemp
- ::清理系统垃圾
- call :quan %dp%\clearn.bat 0
- echo del /f /s /q /a "%%systemdrive%%\*.dmp" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.tmp" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*._mp" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.log" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.gid" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.chk" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.old" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.bak" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%systemdrive%%\*.query" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\inf\*.pnf" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\Driver Cache\*.pnf" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\Driver Cache\InfCache.1" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\system32\drivers\*.pnf" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\system32\drivers\InfCache.1" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\inf\InfCache.1" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\prefetch\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%SystemRoot%%\minidump\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\local settings\temp\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\Locals~1\Tempor~1\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\Locals~1\Temp\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\recent\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%HomePath%%\..\IconCache.db" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\cookies\*.*" >>%dp%\clearn.bat
- echo del /f /s /q /a "%%userprofile%%\local settings\temporary internet files\*.*" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Downloaded Program Files" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Downloaded Program Files" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Offline Web Pages" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Connection Wizard" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\SoftwareDistribution\Download" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Assembly" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\Help" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\system32\ReinstallBackups" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\temp" ^& md "%%SystemRoot%%\temp" >>%dp%\clearn.bat
- echo rd /s /q "%%SystemRoot%%\$hf_mig$" >>%dp%\clearn.bat
- echo reg delete "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" /va /f >>%dp%\clearn.bat
- echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache ^>%temp%\cleantmp.txt >>%dp%\clearn.bat
- echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
- echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
- echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v NetHood ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
- echo reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Recent ^>^>%temp%\cleantmp.txt >>%dp%\clearn.bat
- 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
- echo dir "%%SystemRoot%%\$NtUninstall*" /a:d /b ^>%%temp%%\update.txt >>%dp%\clearn.bat
- echo for /f %%%%i in (%%temp%%\update.txt) do (rd %%SystemRoot%%\%%%%i /s /q )>>%dp%\clearn.bat
- echo dir "%%SystemRoot%%\inf\*.*" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
- echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemRoot%%\inf\%%%%a") >>%dp%\clearn.bat
- echo dir "%%SystemDrive%%\found.???" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
- echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemDrive%%\inf\%%%%a") >>%dp%\clearn.bat
- echo dir "%%SystemRoot%%\$*$" /ad/b ^>%%temp%%\vTmp.txt >>%dp%\clearn.bat
- echo for /f %%%%a in (%%temp%%\vTmp.txt) do ( rd /s /q "%%SystemRoot%%\%%%%a") >>%dp%\clearn.bat
- echo for /f "delims=" %%%%a in ('dir/ad/b "%%temp%%"') do ( rd /s/q "%%temp%%\%%%%a")^&del /s/f/q %%temp%%\*>>%dp%\clearn.bat
- echo for /f "delims=" %%%%a in ('dir/ad/b "%%tmp%%"') do ( rd /s/q "%%tmp%%\%%%%a")^&del /s/f/q %%tmp%%\*>>%dp%\clearn.bat
- echo exit /b>>%dp%\clearn.bat
- call %dp%\clearn.bat&call :soft
复制代码
作者: /zhqsystem/zhq 时间: 2017-10-21 21:09
这玩笑开大了吧,开局一张图内容全靠编,东西那,醉了
作者: yunyan100 时间: 2017-10-21 22:49
回复 2# /zhqsystem/zhq
昨天有点事,没发
作者: 1055367558 时间: 2017-10-22 11:16
回复 3# yunyan100
麻烦过长的代码用[code][/code]编一下,,方便别人
作者: yunyan100 时间: 2017-10-26 13:59
回复 4# 1055367558
我之前发的用code发过,不能成功,不知道是不是太多行,现在少了约200行,可以发了
作者: 老刘1号 时间: 2017-10-28 18:03
回复 5# yunyan100
表示3000行没问题
作者: 风云0928 时间: 2017-10-30 22:58
在吾爱破解网上看到了你的大作,很荣幸
作者: hk7777777 时间: 2017-11-9 14:26
多用点for可以变短点
作者: yunyan100 时间: 2017-11-12 10:11
回复 8# hk7777777
这个是的,有道理,我来改
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |