找回密码
 加入
搜索
查看: 9764|回复: 25

[AU3基础] 怎么把bat格式转换成au3来运行呀?

 火... [复制链接]
发表于 2011-7-4 18:11:38 | 显示全部楼层 |阅读模式
本帖最后由 delphist 于 2011-7-4 18:13 编辑

我有一段bat格式的文件想转换成au3的好转吗?请大家帮忙看看,谢谢


@ECHO OFF

::文本编辑器的完整路径,默认是editplus或notepad。(两边不要加引号)
set editor=

::浏览器的完整路径,默认是IE。(两边不要加引号)
set browser=

::PHPUnit命令参数,以下是示例请自行修改。
set phpunit=--bootstrap bootstrap.php --include-path ..\..\htdocs\ ..\..\htdocs\tests

::phpDocumentor命令参数,以下是示例请自行修改。
set phpdocumentor=-f ..\..\htdocs\index.php -d ..\..\htdocs\manual -ed ..\..\htdocs\examples -t ..\..\htdocs\phpdoc\manual -ti "Documentation" -dn Extension -o HTML:Smarty:PHP

::以上参数可写在配置文件里,以便于升级时不再需要修改此文件
if exist "config.bat" call "config.bat"

::各程序的版本
set coreamp_version=20110401
set apache_version=2.2.17
set php52_version=5.2.17
set php53_version=5.3.5
set mysql_version=5.1.56
set nginx_version=0.8.54
set memcached_version=1.4.5
set subversion_version=1.6.12
set phpunit_version=3.5.13
set phpdocumentor_version=1.4.3
set phpmyadmin_version=3.3.10


::要修改的配置文件
set file1=apache-%apache_version%\conf\httpd-php-%php52_version%.conf
set file2=apache-%apache_version%\conf\httpd-php-%php53_version%.conf
set file3=httpd-vhosts.conf
set file4=nginx-%nginx_version%\conf\nginx.conf
set file5=mysql-%mysql_version%\my.ini-dist
set file6=php-%php52_version%\php.ini-dist
set file7=php-%php53_version%\php.ini-development
set file31=system32\drivers\etc\hosts
set file41=system32\inetsrv\fcgiext.ini
set file51=mysql-%mysql_version%\my.ini-recommended
set file61=php-%php52_version%\php.ini-recommended
set file71=php-%php53_version%\php.ini-production
set file50=mysql-%mysql_version%\my.ini
set file60=php-%php52_version%\php.ini
set file70=php-%php53_version%\php.ini
set file27=mysqld-%mysql_version%.log
set file271=apache-%apache_version%-access.log
set file272=apache-%apache_version%-error.log
set file273=nginx-%nginx_version%-access.log
set file274=nginx-%nginx_version%-error.log
set file_mysql_data=mysql-%mysql_version%\data
set file_svn_conf=subversion-%subversion_version%\conf
set file_svn_repository=subversion-%subversion_version%\svn_repository
set file_htdocs_index=..\htdocs\index.php

::重要的窗口标题
set nginx_title=nginx-%nginx_version%,选择7关闭
TITLE CoreAMP %coreamp_version% 启动检查 - %~dp0

::要检查的各类参数
(set sign_path= && echo %~dp0|findstr "[^0-9a-zA-Z_\\:]" && set sign_path=√)>nul 2>&0
(set sign_high= && if "%os%"=="Windows_NT" (ver|find /i " 6." && set sign_high=√))>nul 2>&0
(if "%sign_high%"==" " (set sign_admin= && net localgroup administrators | find "%USERNAME%" && set sign_admin=√))>nul 2>&0
(if "%sign_high%"=="√" (set sign_admin= && whoami /groups | find "S-1-16-12288" && set sign_admin=√))>nul 2>&0


::显示和判断路径,如果带有空格或中文则提示退出;检查是否以管理员方式运行
if "%sign_path%"=="√" (
        echo ┌────────────────────────────────────┐
        echo │由于Apache的原因,本目录不能含有中文、空格等字符,请改名后再运行控制中心│
        echo └────────────────────────────────────┘
        pause
        goto :eof
)

::生成配置文件
if "%1"=="build-ca-config-files" (
        for /f "tokens=1,2 delims==" %%i in ('set file') do (
                call :rename_to_ca "%~dp0server\%%j"
        )
        pause
        goto :eof
)

::检查配置文件
echo 正在检查各项配置……
for /f "tokens=1,2 delims==" %%i in ('set file') do (
        call :rename_from_ca "%~dp0server\%%j"
)

::如果文件编辑器为空,则使用editplus或notepad
if "%editor%"=="" (
        set editor=notepad
        if exist "%ProgramFiles%\EditPl~1\editplus.exe" (
                set editor=%ProgramFiles%\EditPl~1\editplus.exe
        )
)

::如果浏览器为空,则使用IE
if "%browser%"=="" (
        set browser=%ProgramFiles%\Internet Explorer\iexplore.exe
)


:begin
TITLE CoreAMP %coreamp_version% 控制中心 - %~dp0
cls
echo 正在检查各项服务……
set sign_develope=√
(fc %~dp0server\%file5% %~dp0server\%file50% | find "FC: 找不到" || set sign_develope= )>nul 2>&0
(fc %~dp0server\%file6% %~dp0server\%file60% | find "FC: 找不到" || set sign_develope= )>nul 2>&0
(fc %~dp0server\%file7% %~dp0server\%file70% | find "FC: 找不到" || set sign_develope= )>nul 2>&0
set sign_release=√
(fc %~dp0server\%file51% %~dp0server\%file50% | find "FC: 找不到" || set sign_release= )>nul 2>&0
(fc %~dp0server\%file61% %~dp0server\%file60% | find "FC: 找不到" || set sign_release= )>nul 2>&0
(fc %~dp0server\%file71% %~dp0server\%file70% | find "FC: 找不到" || set sign_release= )>nul 2>&0
(set sign_apache= && sc query .CA.apache | find ".CA.apache" && set sign_apache=√)>nul 2>&0
(set sign_apache_php52= && if "%sign_apache%"=="√" (reg query "HKLM\SYSTEM\CurrentControlSet\Services\.CA.apache\Parameters" | find "php-%php52_version%" && set sign_apache_php52=√))>nul 2>&0
(set sign_apache_php53= && if "%sign_apache%"=="√" (reg query "HKLM\SYSTEM\CurrentControlSet\Services\.CA.apache\Parameters" | find "php-%php53_version%" && set sign_apache_php53=√))>nul 2>&0
(set sign_nginx= && sc query .CA.nginx | find ".CA.nginx" && set sign_nginx=√)>nul 2>&0
(set sign_phpcgi= && sc query .CA.php-cgi | find ".CA.php-cgi" && set sign_phpcgi=√)>nul 2>&0
(set sign_phpcgi_php52= && if "%sign_phpcgi%"=="√" (reg query "HKLM\SYSTEM\CurrentControlSet\Services\.CA.php-cgi\Parameters" | find "php-%php52_version%" && set sign_phpcgi_php52=√))>nul 2>&0
(set sign_phpcgi_php53= && if "%sign_phpcgi%"=="√" (reg query "HKLM\SYSTEM\CurrentControlSet\Services\.CA.php-cgi\Parameters" | find "php-%php53_version%" && set sign_phpcgi_php53=√))>nul 2>&0
(set sign_svnserve= && sc query .CA.svnserve | find ".CA.svnserve" && set sign_svnserve=√)>nul 2>&0
(set sign_memcached= && sc query .CA.memcached | find ".CA.memcached" && set sign_memcached=√)>nul 2>&0
(set sign_mysql= && sc query .CA.mysql | find ".CA.mysql" && set sign_mysql=√)>nul 2>&0
(set sign_apache52= && if "%sign_apache_php52%"=="√" (if "%sign_mysql%"=="√" set sign_apache52=√))>nul 2>&0
(set sign_apache53= && if "%sign_apache_php53%"=="√" (if "%sign_mysql%"=="√" set sign_apache53=√))>nul 2>&0
(set sign_nginx52= && if "%sign_nginx%"=="√" (if "%sign_phpcgi_php52%"=="√" (if "%sign_mysql%"=="√" set sign_nginx52=√)))>nul 2>&0
(set sign_nginx53= && if "%sign_nginx%"=="√" (if "%sign_phpcgi_php53%"=="√" (if "%sign_mysql%"=="√" set sign_nginx53=√)))>nul 2>&0
(if "%sign_apache_php52%"=="√" (if "%sign_mysql%"==" " set sign_apache52=×))>nul 2>&0
(if "%sign_apache_php53%"=="√" (if "%sign_mysql%"==" " set sign_apache53=×))>nul 2>&0
(if "%sign_phpcgi_php52%"=="√" (if "%sign_mysql%"==" " set sign_nginx52=×))>nul 2>&0
(if "%sign_phpcgi_php53%"=="√" (if "%sign_mysql%"==" " set sign_nginx53=×))>nul 2>&0
(if "%sign_nginx%"=="√" (if "%sign_phpcgi_php52%"==" " (if "%sign_phpcgi_php53%"==" " set sign_nginx52=×)))>nul 2>&0
(if "%sign_nginx%"=="√" (if "%sign_phpcgi_php52%"==" " (if "%sign_phpcgi_php53%"==" " set sign_nginx53=×)))>nul 2>&0
:begin_now
cls
%~d0
cd %~dp0
@echo 1: 编辑%file1%
@echo 2: 编辑%file2%
@echo 3: 编辑%file3%                31:编辑%file31%
@echo 4: 编辑%file4%        41:编辑%file41%
@echo 5: 编辑%file5%        51:编辑%file51%
@echo 6: 编辑%file6%                61:编辑%file61%
@echo 7: 编辑%file7%        71:编辑%file71%
@echo 8: 切换到开发环境配置        %sign_develope%                81:切换到运营环境配置        %sign_release%
echo     ----------------------------------------
@echo 11:安装服务 apache-%apache_version%、mysql-%mysql_version%、php-%php52_version% %sign_apache52%
@echo 12:安装服务 apache-%apache_version%、mysql-%mysql_version%、php-%php53_version% %sign_apache53%
@echo 13:安装服务 nginx-%nginx_version%、mysql-%mysql_version%、php-cgi-%php52_version% %sign_nginx52%
@echo 14:安装服务 nginx-%nginx_version%、mysql-%mysql_version%、php-cgi-%php53_version% %sign_nginx53%
@echo 15:删除服务 apache-%apache_version%、nginx-%nginx_version%、mysql-%mysql_version%、php-cgi
@echo 16:安装服务 subversion-%subversion_version%        %sign_svnserve%        161:删除服务 subversion-%subversion_version%
@echo 17:安装服务 memcached-%memcached_version%        %sign_memcached%        171:删除服务 memcached-%memcached_version%
@echo 18:安装服务 mysql-%mysql_version%        %sign_mysql%        181:删除服务 mysql-%mysql_version%
echo     ----------------------------------------
@echo 21:访问http://localhost/                211:访问phpMyAdmin
@echo 22:执行php程序片段                        23:启动mysql客户端
@echo 24:执行phpunit(需先调整参数)                25:执行phpdocumentor(需先调整参数)
@echo 26:查看当前所有服务                        261:查看当前所有进程
@echo 27:查看mysql日志  271/272:apache访问/错误日志  273/274:nginx访问/错误日志
@echo 0: 进入临时控制台

set input=
set /p input=请输入选择:
if %input%==0 goto begin2
if %input%==1 call :edit_file %~dp0server\%file1% & goto begin_now
if %input%==2 call :edit_file %~dp0server\%file2% & goto begin_now
if %input%==3 call :edit_file %~dp0server\%file3% & goto begin_now
if %input%==4 call :edit_file %~dp0server\%file4% & goto begin_now
if %input%==5 call :edit_file %~dp0server\%file5% & goto begin_now
if %input%==6 call :edit_file %~dp0server\%file6% & goto begin_now
if %input%==7 call :edit_file %~dp0server\%file7% & goto begin_now
if %input%==8 call :alter_develope & goto begin
if %input%==31 call :edit_file %windir%\%file31% & goto begin_now
if %input%==41 call :edit_file %windir%\%file41% & goto begin_now
if %input%==51 call :edit_file %~dp0server\%file51% & goto begin_now
if %input%==61 call :edit_file %~dp0server\%file61% & goto begin_now
if %input%==71 call :edit_file %~dp0server\%file71% & goto begin_now
if %input%==81 call :alter_release & goto begin
if %input%==11 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_apache
                call :stop_nginx
                call :stop_php_cgi
                call :stop_mysql
                call :check_port80
                call :start_apache %php52_version%
                call :check_port3306
                call :start_mysql
                pause
        )
        goto begin
)
if %input%==12 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_apache
                call :stop_nginx
                call :stop_php_cgi
                call :stop_mysql
                call :check_port80
                call :start_apache %php53_version%
                call :check_port3306
                call :start_mysql
                pause
        )
        goto begin
)
if %input%==13 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_apache
                call :stop_nginx
                call :stop_php_cgi
                call :stop_mysql
                call :alert_360
                call :check_port80
                call :start_nginx
                call :check_port9000
                call :start_php_cgi %php52_version%
                call :check_port3306
                call :start_mysql
                pause
        )
        goto begin
)
if %input%==14 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_apache
                call :stop_nginx
                call :stop_php_cgi
                call :stop_mysql
                call :alert_360
                call :check_port80
                call :start_nginx
                call :check_port9000
                call :start_php_cgi %php53_version%
                call :check_port3306
                call :start_mysql
                pause
        )
        goto begin
)
if %input%==15 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_apache
                call :stop_nginx
                call :stop_php_cgi
                call :stop_mysql
        )
        goto begin
)
if %input%==16 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_subversion
                call :alert_360
                call :start_subversion
                pause
        )
        goto begin
)
if %input%==161 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" call :stop_subversion
        goto begin
)
if %input%==17 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_memcached
                call :alert_360
                call :start_memcached
                pause
        )
        goto begin
)
if %input%==171 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" call :stop_memcached
        goto begin
)
if %input%==18 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" (
                call :stop_mysql
                call :check_port3306
                call :start_mysql
                pause
        )
        goto begin
)
if %input%==181 (
        if "%sign_admin%"==" " call :alert_admin
        if "%sign_admin%"=="√" call :stop_mysql
        goto begin
)
if %input%==21 call :open_url http://localhost/ & goto begin_now
if %input%==211 call :open_url http://localhost/phpMyAdmin-%phpmyadmin_version%-all-languages/ & goto begin_now
if %input%==22 start server\php.bat & goto begin_now
if %input%==23 start server\mysql.bat & goto begin_now
if %input%==24 start %~dp0server\phpunit-%phpunit_version%\phpunit.bat %phpunit% & goto begin_now
if %input%==25 start %~dp0server\phpdocumentor-%phpdocumentor_version%\phpdoc.bat %phpdocumentor% & goto begin_now
if %input%==26 start Services.msc & goto begin_now
if %input%==261 start taskmgr & goto begin_now
if %input%==27 call :edit_file %~dp0server\%file27% & goto begin_now
if %input%==271 call :edit_file %~dp0server\%file271% & goto begin_now
if %input%==272 call :edit_file %~dp0server\%file272% & goto begin_now
if %input%==273 call :edit_file %~dp0server\%file273% & goto begin_now
if %input%==274 call :edit_file %~dp0server\%file274% & goto begin_now
if exist %input% call :open_file %input% & goto begin_now
goto begin

:alter_develope
echo copy /y server\%file5% server\%file50%
copy /y %~dp0server\%file5% %~dp0server\%file50%
echo copy /y server\%file6% server\%file60%
copy /y %~dp0server\%file6% %~dp0server\%file60%
echo copy /y server\%file7% server\%file70%
copy /y %~dp0server\%file7% %~dp0server\%file70%
echo 已切换到开发环境配置
pause
goto :eof

:alter_release
echo copy /y server\%file51% server\%file50%
copy /y %~dp0server\%file51% %~dp0server\%file50%
echo copy /y server\%file61% server\%file60%
copy /y %~dp0server\%file61% %~dp0server\%file60%
echo copy /y server\%file71% server\%file70%
copy /y %~dp0server\%file71% %~dp0server\%file70%
echo 已切换到运营环境配置
pause
goto :eof

:edit_file
if exist %1 start "" "%editor%" "%1"
goto :eof

:open_url
start "" "%browser%" "%1"
goto :eof

:open_file
setlocal enabledelayedexpansion
set url=%1
set url=!url:%~dp0=http://!
set url=!url:http://htdocs=http://localhost!
call :open_url %url%
endlocal
goto :eof

:rename_to_ca
if exist "%~1" (
        if not exist "%~1.ca" (
                rename "%~1" "%~nx1.ca"
        ) else (
                del /S /Q "%~1"
        )
)
goto :eof

:rename_from_ca
if exist "%~1.ca" (
        if not exist "%~1" (
                rename "%~1.ca" "%~nx1"
        ) else (
                del /S /Q "%~1.ca"
        )
)
goto :eof

:alert_admin
if "%sign_high%"==" " (
        echo ┌────────────────────────────────────┐
        echo │由于安装或删除服务需要有较高的身份,请使用管理员帐号登录后再运行控制中心│
        echo └────────────────────────────────────┘
)
if "%sign_high%"=="√" (
        echo ┌────────────────────────────────────┐
        echo │由于安装或删除服务需要有较高的身份,请右键点击并以管理员身份运行控制中心│
        echo └────────────────────────────────────┘
)
pause
goto :eof

:alert_360
echo ┌─────────────────────────────────────┐
echo │提示:安装服务时会调用系统的sc.exe和reg.exe,请在防火墙弹出提示时予以通过 │
echo │   如果需要经常重启服务,可关闭360木马防火墙的进程防火墙和注册表防火墙 │
echo └─────────────────────────────────────┘
goto :eof

:check_port80
((netstat -ano|find "0.0.0.0:80 " || netstat -ano|find "127.0.0.1:80 "|find "LISTENING")>nul && (
        echo ┌─────────────────────────────────────┐
        echo │提示:80端口已被其他程序占用,请关闭占用该端口的软件或者配置使用其他的端口│
        echo └─────────────────────────────────────┘
))
goto :eof

:check_port3306
((netstat -ano|find "0.0.0.0:3306 " || netstat -ano|find "127.0.0.1:3306 "|find "LISTENING")>nul && (
        echo ┌─────────────────────────────────────┐
        echo │提示:3306端口已被其他程序占用,请关闭占用该端口的软件或配置使用其他的端口│
        echo └─────────────────────────────────────┘
))
goto :eof

:check_port9000
((netstat -ano|find "0.0.0.0:9000 " || netstat -ano|find "127.0.0.1:9000 "|find "LISTENING")>nul && (
        echo ┌─────────────────────────────────────┐
        echo │提示:9000端口已被其他程序占用,请关闭占用该端口的软件以确保PHPCGI正常运行│
        echo └─────────────────────────────────────┘
))
goto :eof

:start_apache
(copy /y %~dp0server\php-%1\*.dll %~dp0server\apache-%apache_version%)>nul 2>&0
%~dp0server\apache-%apache_version%\bin\httpd -d %~dp0server\apache-%apache_version% -f %~dp0server\apache-%apache_version%\conf\httpd-php-%1.conf -k install -n .CA.apache
net start .CA.apache
goto :eof

:stop_apache
(sc query .CA.apache | find ".CA.apache">nul && net stop .CA.apache)
(sc query .CA.apache | find ".CA.apache">nul && sc delete .CA.apache)
(tasklist /FI "IMAGENAME eq httpd.exe" | find "httpd">nul && taskkill /f /im httpd.exe) 2>&0
if exist "%~dp0server\apache-%apache_version%\*.dll" (del /q /f %~dp0server\apache-%apache_version%\*.dll)
goto :eof

:start_mysql
%~dp0server\mysql-%mysql_version%\bin\mysqld --install .CA.mysql
(sc query .CA.mysql | find ".CA.mysql">nul && net start .CA.mysql)
goto :eof

:stop_mysql
(sc query .CA.mysql | find ".CA.mysql">nul && net stop .CA.mysql)
(sc query .CA.mysql | find ".CA.mysql">nul && sc delete .CA.mysql)
(tasklist /FI "IMAGENAME eq mysqld.exe" | find "mysqld">nul && taskkill /f /im mysqld.exe) 2>&0
goto :eof

:start_nginx
sc create .CA.nginx binpath= "%~dp0server\nginx-%nginx_version%\srvany.exe" displayname= ".CA.nginx" start= auto
(sc query .CA.nginx | find ".CA.nginx">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.nginx\Parameters" /v "Application" /d "%~dp0server\\nginx-%nginx_version%\\nginx.exe")
(sc query .CA.nginx | find ".CA.nginx">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.nginx\Parameters" /v "AppParameters" /d "")
(sc query .CA.nginx | find ".CA.nginx">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.nginx\Parameters" /v "AppDirectory" /d "%~dp0server\\nginx-%nginx_version%\\")
(sc query .CA.nginx | find ".CA.nginx">nul && net start .CA.nginx)
goto :eof

:stop_nginx
(sc query .CA.nginx | find ".CA.nginx">nul && net stop .CA.nginx)
(sc query .CA.nginx | find ".CA.nginx">nul && sc delete .CA.nginx)
(tasklist /FI "IMAGENAME eq nginx.exe" | find "nginx">nul && taskkill /f /im nginx.exe) 2>&0
(tasklist /FI "WINDOWTITLE eq %nginx_title%" | find "cmd">nul && taskkill /f /FI "WINDOWTITLE eq %nginx_title%") 2>&0
goto :eof

:start_php_cgi
sc create .CA.php-cgi binpath= "%~dp0server\php-%1\srvany.exe" displayname= ".CA.php-cgi" start= auto
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.php-cgi\Parameters" /v "Application" /d "%~dp0server\\php-%1\\php-cgi.exe -b 0.0.0.0:9000")
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.php-cgi\Parameters" /v "AppParameters" /d "")
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.php-cgi\Parameters" /v "AppDirectory" /d "%~dp0server\\php-%1\\")
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && net start .CA.php-cgi)
goto :eof

:stop_php_cgi
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && net stop .CA.php-cgi)
(sc query .CA.php-cgi | find ".CA.php-cgi">nul && sc delete .CA.php-cgi)
(tasklist /FI "IMAGENAME eq php-cgi.exe" | find "php-cgi">nul && taskkill /f /im php-cgi.exe) 2>&0
goto :eof

:start_subversion
cd server\subversion-%subversion_version%
if not exist "svn_repository\trunk" svnadmin create svn_repository\trunk
if not exist "svn_repository\branches" svnadmin create svn_repository\branches
if not exist "svn_repository\tags" svnadmin create svn_repository\tags
sc create .CA.svnserve binpath= "%~dp0server\subversion-%subversion_version%\svnserve --service -r %~dp0server\subversion-%subversion_version%\svn_repository --config-file %~dp0server\subversion-%subversion_version%\conf\svnserve.conf" displayname= ".CA.svnserve" start= auto
(sc query .CA.svnserve | find ".CA.svnserve">nul && net start .CA.svnserve)
cd %~dp0
goto :eof

:stop_subversion
(sc query .CA.svnserve | find ".CA.svnserve">nul && net stop .CA.svnserve)
(sc query .CA.svnserve | find ".CA.svnserve">nul && sc delete .CA.svnserve)
(tasklist /FI "IMAGENAME eq svnserve.exe" | find "svnserve">nul && taskkill /f /im svnserve.exe) 2>&0
goto :eof

:start_memcached
sc create .CA.memcached binpath= "%~dp0server\memcached-%memcached_version%\srvany.exe" displayname= ".CA.memcached" start= auto
(sc query .CA.memcached | find ".CA.memcached">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.memcached\Parameters" /v "Application" /d "%~dp0server\\memcached-%memcached_version%\\memcached.exe")
(sc query .CA.memcached | find ".CA.memcached">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.memcached\Parameters" /v "AppParameters" /d "")
(sc query .CA.memcached | find ".CA.memcached">nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.CA.memcached\Parameters" /v "AppDirectory" /d "%~dp0server\\memcached-%memcached_version%\\")
(sc query .CA.memcached | find ".CA.memcached">nul && net start .CA.memcached)
cd %~dp0
goto :eof

:stop_memcached
(sc query .CA.memcached | find ".CA.memcached">nul && net stop .CA.memcached)
(sc query .CA.memcached | find ".CA.memcached">nul && sc delete .CA.memcached)
(tasklist /FI "IMAGENAME eq memcached.exe" | find "memcached">nul && taskkill /f /im memcached.exe) 2>&0
goto :eof


::
::以下是自定义控制台,可以在此编辑
::


:begin2
TITLE CoreAMP %coreamp_version% 临时控制台 - %~dp0
cls
(set sign= && tasklist /FI "WINDOWTITLE eq 启动apache-%apache_version%、php-%php52_version%,按Ctrl+C关闭" | find "httpd" && set sign=√)>nul 2>&0
@echo 1、 启动控制台 apache-%apache_version%、mysql-%mysql_version%、php-%php52_version% %sign%
(set sign= && tasklist /FI "WINDOWTITLE eq 启动apache-%apache_version%、php-%php53_version%,按Ctrl+C关闭" | find "httpd" && set sign=√)>nul 2>&0
@echo 2、 启动控制台 apache-%apache_version%、mysql-%mysql_version%、php-%php53_version% %sign%
(set sign= && tasklist /FI "IMAGENAME eq nginx.exe" | find "nginx" && tasklist /FI "WINDOWTITLE eq 启动php-cgi-%php52_version%,按Ctrl+C关闭" | find "php-cgi" && set sign=√)>nul 2>&0
@echo 3、 启动控制台 nginx-%nginx_version%、mysql-%mysql_version%、php-cgi-%php52_version% %sign%
(set sign= && tasklist /FI "IMAGENAME eq nginx.exe" | find "nginx" && tasklist /FI "WINDOWTITLE eq 启动php-cgi-%php53_version%,按Ctrl+C关闭" | find "php-cgi" && set sign=√)>nul 2>&0
@echo 4、 启动控制台 nginx-%nginx_version%、mysql-%mysql_version%、php-cgi-%php53_version% %sign%
@echo 5、 关闭控制台 apache-%apache_version%、nginx-%nginx_version%、mysqld-%mysql_version%、php-cgi
(set sign= && tasklist /FI "WINDOWTITLE eq 启动subversion-%subversion_version%,按Ctrl+C关闭" | find "svnserve" && set sign=√)>nul 2>&0
@echo 6、 启动控制台 subversion-%subversion_version%%sign%        61、 关闭控制台 subversion-%subversion_version%
(set sign= && tasklist /FI "WINDOWTITLE eq 启动memcached-%memcached_version%,按Ctrl+C关闭" | find "memcached" && set sign=√)>nul 2>&0
@echo 7、 启动控制台 memcached-%memcached_version%        %sign%        71、 关闭控制台 memcached-%memcached_version%
(set sign= && tasklist /FI "WINDOWTITLE eq 启动mysqld-%mysql_version%,按Ctrl+C关闭" | find "mysqld" && set sign=√)>nul 2>&0
@echo 8、 启动控制台 mysql-%mysql_version%        %sign%        81、 关闭控制台 mysql-%mysql_version%
echo     ----------------------------------------
@echo 11、apache-%apache_version%.bat
@echo 12、nginx-%nginx_version%.bat
@echo 13、mysqld-%mysql_version%.bat
@echo 14、mysql.bat
@echo 15、php.bat
@echo 16、php-cgi.bat
@echo 17、subversion-%subversion_version%.bat
@echo 18、memcached-%memcached_version%.bat
@echo 19、phpunit-%phpunit_version%
@echo 20、phpdocumentor-%phpdocumentor_version%.bat
@echo 21、php-%php52_version%\go-pear.bat
@echo 22、php-%php53_version%\go-pear.bat
echo.
echo     ----------------------------------------
@echo 0、 返回控制中心

setlocal enabledelayedexpansion
set input=
set /p input=请输入选择:
if %input%==0 goto begin
if %input%==1 (
        call :check_services
        call :open_apache %php52_version%
        call :open_mysql
)
if %input%==2 (
        call :check_services
        call :open_apache %php53_version%
        call :open_mysql
)
if %input%==3 (
        call :check_services
        call :open_nginx
        call :open_php_cgi %php52_version%
        call :open_mysql
)
if %input%==4 (
        call :check_services
        call :open_nginx
        call :open_php_cgi %php53_version%
        call :open_mysql
)
if %input%==5 call :check_services
if %input%==6 (
        call :check_service svnserve
        call :open_subversion
)
if %input%==7 (
        call :check_service memcached
        call :open_memcached
)
if %input%==8 (
        call :check_service mysql
        call :open_mysql
)
if %input%==61 call :check_service svnserve
if %input%==71 call :check_service memcached
if %input%==81 call :check_service mysql
if %input%==11 start server\apache-%apache_version%.bat
if %input%==12 start server\nginx-%nginx_version%.bat
if %input%==13 start server\mysqld-%mysql_version%.bat
if %input%==14 start server\mysql.bat
if %input%==15 start server\php.bat
if %input%==16 start server\php-cgi.bat
if %input%==17 start server\subversion-%subversion_version%.bat
if %input%==18 start server\memcached-%memcached_version%.bat
if %input%==19 start server\phpunit-%phpunit_version%
if %input%==20 start server\phpdocumentor-%phpdocumentor_version%.bat
if %input%==21 (
        cd server\php-%php52_version%
        start go-pear.bat
        cd %~dp0
)
if %input%==22 (
        cd server\php-%php53_version%
        start go-pear.bat
        cd %~dp0
)
endlocal
goto begin2

:check_services
set check=0
(sc query .CA.apache | find ".CA.apache" && set check=1)>nul 2>&0
(sc query .CA.mysql | find ".CA.mysql" && set check=1)>nul 2>&0
(sc query .CA.nginx | find ".CA.nginx" && set check=1)>nul 2>&0
(sc query .CA.php-cgi | find ".CA.php-cgi" && set check=1)>nul 2>&0
if %check%==0 (
        (taskkill /f /im httpd.exe)>nul 2>&0
        (taskkill /f /im mysqld.exe)>nul 2>&0
        (taskkill /f /im nginx.exe)>nul 2>&0
        (taskkill /f /im php-cgi.exe)>nul 2>&0
        (tasklist /FI "WINDOWTITLE eq %nginx_title%" | find "cmd" && taskkill /f /FI "WINDOWTITLE eq %nginx_title%") > nul 2>&0
)
if %check%==1 (
        echo →已存在相应的服务,请在停止相应服务后再启动控制台←
        pause
)
goto :eof

:check_service
set service_name=%1
set execute_name=%1
if "%service_name%"=="mysql" (
        set execute_name=mysqld
)
set check=0
(sc query .CA.%service_name% | find ".CA.%service_name%" && set check=1)>nul 2>&0
if %check%==0 (
        (taskkill /f /im %execute_name%.exe)>nul 2>&0
)
if %check%==1 (
        echo →已存在相应的服务,请在停止相应服务后再启动控制台←
        pause
)
goto :eof


:open_apache
if %check%==0 (
        start /MIN "启动apache-%apache_version%、php-%1,按Ctrl+C关闭" /d%~dp0server\php-%1 server\apache-%apache_version%\bin\httpd -d ..\apache-%apache_version% -f ..\apache-%apache_version%\conf\httpd-php-%1.conf -w
)
goto :eof

:open_nginx
if %check%==0 (
        start /d%~dp0server\nginx-%nginx_version% server\nginx-%nginx_version%\nginx
        start /MIN %~dp0server\nginx-%nginx_version%.bat
)
goto :eof

:open_php_cgi
if %check%==0 (
        start /MIN "启动php-cgi-%1,按Ctrl+C关闭" /d%~dp0server\php-%1 server\php-%1\php-cgi -b 0.0.0.0:9000
)
goto :eof

:open_mysql
if %check%==0 (
        start /MIN "启动mysqld-%mysql_version%,按Ctrl+C关闭" /d%~dp0server server\mysql-%mysql_version%\bin\mysqld --defaults-file=mysql-%mysql_version%\my.ini --console
)
goto :eof


:open_subversion
if %check%==0 (
        if not exist "server\subversion-%subversion_version%\svn_repository\trunk" server\subversion-%subversion_version%svnadmin create server\subversion-%subversion_version%\svn_repository\trunk
        if not exist "server\subversion-%subversion_version%\svn_repository\branches" server\subversion-%subversion_version%\svnadmin create server\subversion-%subversion_version%\svn_repository\branches
        if not exist "server\subversion-%subversion_version%\svn_repository\tags" server\subversion-%subversion_version%\svnadmin create server\subversion-%subversion_version%\svn_repository\tags
        start /MIN "启动subversion-%subversion_version%,按Ctrl+C关闭" server\subversion-%subversion_version%\svnserve -d -r server\subversion-%subversion_version%\svn_repository --config-file server\subversion-%subversion_version%\conf\svnserve.conf --foreground
)
goto :eof

:open_memcached
if %check%==0 (
        start /MIN "启动memcached-%memcached_version%,按Ctrl+C关闭" server\memcached-%memcached_version%\memcached.exe
)
goto :eof


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-7-5 11:40:36 | 显示全部楼层
这么长一个批处理代码,要转换成AU3,不仅是脑力活,还是纯体力活

直接RUN  批处理方便多了
发表于 2011-7-5 13:30:20 | 显示全部楼层
同意楼上的
发表于 2011-7-5 20:08:03 | 显示全部楼层
phpnow的安装文件吧   有交互操作
 楼主| 发表于 2011-7-5 20:22:21 | 显示全部楼层
恩,想改成au3的,不知是否有点难度。。
发表于 2011-7-5 21:34:33 | 显示全部楼层
论坛里也有bat转AU3的教程,可以参考下
但是这个BAT说句实话,做完了一定很很很辛苦滴。。。。
发表于 2011-7-5 23:24:42 | 显示全部楼层
任何通用的bat转au3的方法不都适用于本例的
 楼主| 发表于 2011-7-6 08:22:54 | 显示全部楼层
本帖最后由 delphist 于 2011-7-6 08:27 编辑

谁帮忙写这个au3呀,报酬10QB,可以留下联系方式或站内短信,谢谢。。。
发表于 2011-7-6 20:28:04 | 显示全部楼层
可以试一下论坛里面的转换工具
发表于 2011-7-6 22:07:13 | 显示全部楼层
一个不小工程
发表于 2011-7-6 22:12:47 | 显示全部楼层
回复 8# delphist


    看了下,难度到没有啥,就是太长了,写起来费神呀
 楼主| 发表于 2011-7-6 22:35:41 | 显示全部楼层
回复 11# happytc


    可以帮忙吗?10QB
发表于 2011-7-6 22:39:38 | 显示全部楼层
回复 12# delphist


    呵,没有那个时间呀

其实你为什么一定要转成au3的呢,直接用bat不一样呀?
发表于 2011-7-8 13:08:31 | 显示全部楼层
呵呵,代码真的是长,用工具是转换不了的,得手工改。大工程呀
发表于 2011-7-8 13:30:15 | 显示全部楼层
代码真的是长
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-26 10:02 , Processed in 0.081077 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表