织梦一键安装包制作详解

      先看代码:

 1 @echo off
 2 ::install wamp
 3 start /b/wait WampServer2.1a-x32.exe /B/wait
 4 
 5 
 6 ::set all driver
 7 set alldriver=c d e f g h i j k
 8 
 9 ::clear the folder
10 del /q d:\1\*
11 for %%i in (%alldriver%) do if exist %%i:\wamp\www del /q %%i:\wamp\www\*
12 
13 ::cycle all driver for finding the file,and copy one file to another folder
14 for %%i in (%alldriver%) do if exist %%i:\wamp xcopy website %%i:\wamp\www /e
15 
16 ::pause
17 
18 
19 ::start mysql-5.5.28-win32.msi
20 ::start php-5.3.18-Win32-VC9-x86.msi

代码解释:

@:不显示@后面的代码;

echo off:关闭DOS窗口的代码和输出显示

start /b/wait WampServer2.1a-x32.exe /B/wait:

  start:启动该应用程序,

  /b:启动应用程序,但不创建新窗口,

  /wait:等待程序停止;

set alldriver=c d e f g h i j k:设置环境变量(set alldriver),盘符为c d e f g h i j k;

for %%i in (%alldriver%) do if exist %%i:\wamp\www del /q %%i:\wamp\www\*:

  for %%xx in (x x x x) do:循环,

  if exitst xx:判断文件夹是否存在,  

  del:删除文件,加/q表示DOS不提示;

for %%i in (%alldriver%) do if exist %%i:\wamp xcopy website %%i:\wamp\www /e:

  xcopy:拷贝website目录下的文件(夹)到www文件夹下,加/e表示复制website目录下所有文件和文件夹;

%%:两个%在一起,后面加字母,如%%i,用法有二,一是:用在for语句中,相当于变量,二是:用在外部参数;

%i%:环境变量,如在上文中设置了set i = 3,下文中%i%就是引用上文中i = 3这个值。

  1.将该代码写入install.bat文件中,即批处理。

  2.把网站的程序(dede)放到website文件夹里。

  3.将开发环境wamp软件放到同目录下。

  如下图所示:

  4.然后再用winrar打包成自解压文件即可。

原文地址:https://www.cnblogs.com/thinksasa/p/2779534.html