CODE: [Copy to clipboard]
@echo off
::批处理给当前其他批处理打包,通过修改的话还能扩展很多功能.利用了一些特效中的技巧.
::blog hi.baidu.com/523066680
::made by 523066680@cn-dos.net 和bbs.bathome.cn
set pname=SetupBat.bat
for %%a in (*.bat) do (
if not "%%a"=="%~nx0" (
if not "%%a"=="%pname%" (call,set file="%%a" %%file%%)
)
)
echo,@set file=%file%>"%pname%"
set "act="
::重定向 执行部分
for /f "delims= eol=" %%a in (%~snx0) do (
if "%%a"=="::%pname% end" (goto :next)
if defined act echo,%%a>>"%pname%"
if "%%a"=="::%pname%" set act=act
)
:next
::- - - - - - -重定向内容 - - - - - - - -
for %%a in (*.bat) do (
if not "%%a"=="%~nx0" (
if not "%%a"=="%pname%" (
echo,::%%a>>"%pname%"
type "%%a">>"%pname%"
echo,>>"%pname%"
echo,::%%a end>>"%pname%"
)
)
)
::- - - - - - - - - - - - - - - - - - - -//重定向结束//
if not exist %~sdp0tempfolder (md %~sdp0\tempfolder)
move "%pname%" "%~sdp0tempfolder\"
exit
::SetupBat.bat
@echo off
for %%a in (%file%) do (call :setup %%~a)
exit
:setup
set "act="
for /f "delims= eol=" %%a in (%~nx0) do (
if "%%a"=="::%* end" (goto :eof)
if defined act echo,%%a>>"%*"
if "%%a"=="::%*" errcommand>"%*" 2>nul&set act=act
)
::SetupBat.bat end
它可以干什么呢?可以给当前除本身以外的批处理打包(改改的话其他文本类文件也行)CODE: [Copy to clipboard]
@echo off
::脚本打包工具 打包文本类型的文件,空行会被去掉
::blog hi.baidu.com/523066680
::made by 523066680@cn-dos.net 和bbs.bathome.cn
:a
echo,请正确输入。&echo,
set /p type="请输入将打包的脚本的格式 一种(如 bat,txt...): "
set /p name="包裹的名称(如 parcel ,则生成parcel.bat): "
if not exist "*.%type%" (echo,不存在该格式文件 &pause>nul &cls &goto :a)
if exist "tempfolder\%name%.bat" (echo,将对 tempfolder 文件夹中已存在的%name%.bat 进行覆盖 &pause)
set "tempname=thisistempfilename.x"
if not exist tempfolder (md tempfolder)
for %%a in (*.%type%) do (
if not "%%a"=="%~nx0" (
if not "%%a"=="%tempname%" (call,set file="%%a" %%file%%)
)
)
echo,@set file=%file%>"%tempname%"
set "act="
::重定向 执行部分
for /f "delims= eol=" %%a in (%~snx0) do (
if "%%a"=="::%tempname% end" (goto :next)
if defined act echo,%%a>>"%tempname%"
if "%%a"=="::%tempname%" set act=act
)
:next
::- - - - - - -重定向内容 - - - - - - - -
for %%a in (*.%type%) do (
if not "%%a"=="%~nx0" (
if not "%%a"=="%tempname%" (
echo,::%%a>>"%tempname%"
type "%%a">>"%tempname%"
echo,>>"%tempname%"
echo,::%%a end>>"%tempname%"
)
)
)
::- - - - - - - - - - - - - - - - - - - -//重定向结束//
ren "thisistempfilename.x" "%name%.bat"
move "%name%.bat" "tempfolder\%name%.bat"
echo,成功生成包裹%name%.bat 在 tempfolder 文件夹中
pause
exit
::thisistempfilename.x
@echo off
for %%a in (%file%) do (call :setup %%~a)
exit
:setup
set "act="
for /f "delims= eol=" %%a in (%~nx0) do (
if "%%a"=="::%* end" (goto :eof)
if defined act echo,%%a>>"%*"
if "%%a"=="::%*" errcommand>"%*" 2>nul&set act=act
)
::thisistempfilename.x end
[CODE: [Copy to clipboard]
@set file="进度条细节版.bat" "动感曲线2.bat"
@echo off
for %%a in (%file%) do (call :setup %%~a)
exit
:setup
set "act="
for /f "delims= eol=" %%a in (%~nx0) do (
if "%%a"=="::%* end" (goto :eof)
if defined act echo,%%a>>"%*"
if "%%a"=="::%*" errcommand>"%*" 2>nul&set act=act
)
::动感曲线2.bat
@echo off &setlocal enabledelayedexpansion
title code by 523066680@cn-dos.net 2008-12-23 娱乐 - 动感曲线2
for /l %%a in (1,1,20) do (set blank= !blank!)
set now=10
:a
set /a a=%random%%%10
if %a% gtr %now% (set "add=+" &set "str=#") else (set "add=-" &set "str=+")
:a1
echo, !blank:~0,%now%!%str%
ping -n 1 127.1>nul
ping -n 1 127.1>nul
if %now% equ %a% (goto :a)
set /a now%add%=1
goto :a1
::慢慢地看,能看到旋转的效果。如果能看到,就会觉得很漂亮。
::当看到带子往一个方向旋转的时候,感觉很难再看成是往另一个方向...
::动感曲线2.bat end
::进度条细节版.bat
@echo off&setlocal enabledelayedexpansion&mode con cols=25 lines=1
title 进度条
set /a a=0
:a
set /a a+=1
for %%a in (▏ ▎ ▍ ▌ ▋ ▊ ▉) do (set /p=%%a<nul &ping -n 1 127.1>nul &ping -n 1 127.1>nul &ping -n 1 127.1>nul &set /p= <nul)
set /p=█<nul
if %a% lss 10 (goto :a)
set /p= End<nul&pause>nul
::进度条细节版.bat end