用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
hust_wh的公告
<div class="leftmenu"> <b>个人资料</b><br> 城市:武汉<br> QQ :5383574<br> Email:hust_wh@163.com<br> <!-- Blog日历表开始 --> <script language="javascript"> var diarydays=""; </script> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style> .calendarBigBorder { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; text-decoration: none; width: 170; background-color: #FFFFFF; font-size: 9pt;border:1px dotted #999; } .calendarTd { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #000000; background-color: #eeeeee; height: 18px; width: 11%; text-align: center;} .calendarMInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; text-decoration: none; background-color: #FFFFFF; height: 15px; border: 1px solid #666666; width: 19px; color: #0099FF;} .calendarYInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #0099FF; text-decoration: none; background-color: #FFFFFF; height: 15px; width: 34px; border: 1px solid #666666;} .calendarMonthTitle { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; height: 24px; text-align: center; color: #333333; text-decoration: none; background-color: #eeeeee; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: none; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999;} .calendarNow { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: bold; color: #000000; background-color: #C0C9D3; height: 18px; text-align: center;} .calendarDaySat { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;} .calendarDaySun { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;} .calendarLink { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; color: #333333; text-decoration: none; background-color: #E7E7F6; text-align: center; height: 18px;} .categoryTxt { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; line-height: 23px; color: #333333; text-decoration: none;} .categoryTable { border-right-width: 1px; border-bottom-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-right-color: #000000; border-bottom-color: #000000; border-top-width: 1px; border-top-style: solid; border-top-color: #71b99c;} </style> <SCRIPT LANGUAGE="JavaScript"> var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二"); var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31); var days = new Array("日","一", "二", "三","四", "五", "六"); var classTemp; var calendarHover="calendarHover"; var today=new getToday(); var year=today.year; var month=today.month; var newCal; //得到某月天数 function getDays(month, year) { if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28; else return daysInMonth[month]; } //得到当天时间信息 function getToday() { this.now = new Date(); this.year = this.now.getFullYear(); this.month = this.now.getMonth(); this.day = this.now.getDate(); } //生成日历 function Calendar() { newCal = new Date(year,month,1); //当前月的第一天 today = new getToday(); var day = -1; //用来判断日历中是否为当天 var startDay = newCal.getDay(); //当月开始时间 var endDay=getDays(newCal.getMonth(), newCal.getFullYear());//当月结束时间 var daily = 0; //用来生成日历中的天数值 if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth())) day = today.day; var caltable = document.all.caltable.tBodies.calendar; //得到日历表格的集合 var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); //得到当月天数 //生成日历 for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++) for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++) { var cell = caltable.rows[intWeek].cells[intDay]; //得到单元袼 //生成字符串用于判断当天是否有日志 var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1); if ((intDay == startDay) && (0 == daily)){ daily = 1;} var daytemp=daily<10?("0"+daily):(daily); var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">"; //选择样式 if(day==daily) cell.className="calendarNow"; else if(diarydays.indexOf(d)!=-1) cell.className="calendarLink"; else if(intDay==6) cell.className = "calendarDaySat"; else if (intDay==0) cell.className ="calendarDaySun"; else cell.className="calendarTd"; //生成值 if ((daily > 0) && (daily <= intDaysInMonth)) { cell.innerText = daily; daily++; } else cell.innerText = ""; } document.all.year.value=year; document.all.month.value=month+1; } function subMonth() { if ((month-1)<0) { month=11; year=year-1; } else { month=month-1; } Calendar(); } function addMonth() { if((month+1)>11) { month=0; year=year+1; } else { month=month+1; } Calendar(); } //得到响应事件 function getDiary() { var mon=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1); var day=event.srcElement.innerText<10?("0"+event.srcElement.innerText):(event.srcElement.innerText); var d="<"+newCal.getFullYear()+"-"+mon+"-"+day+">"; if ("TD" == event.srcElement.tagName) if (("" != event.srcElement.innerText)&&(diarydays.indexOf(d)!=-1)) { diary.location="/chensheng913/archive/"+newCal.getFullYear()+"/"+mon+"/"+day+".aspx"; window.location.href = diary.location; } } function setDate() { if (document.all.month.value<1||document.all.month.value>12) { alert("月的有效范围在1-12之间!"); return; } year=Math.ceil(document.all.year.value); month=Math.ceil(document.all.month.value-1); Calendar(); } </SCRIPT> <table border="0" cellpadding="0" cellspacing="1" class="calendarBigBorder" id="caltable" width="180"> <thead> <tr align="center" valign="middle"> <td colspan="7" class="calendarMonthTitle"> <input name="year" type="text" class="calendarYInput" size="3" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">年 <input name="month" type="text" class="calendarMInput" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">月 [<a onClick="addMonth()" href="javascript:;">下月</a>] [<a onClick="subMonth()" href="javascript:;">上月</a>]</td> </tr> <tr align="center" valign="middle"> <SCRIPT LANGUAGE="JavaScript"> document.write("<TD class=calendarDaySun id=diary>" + days[0] + "</TD>"); for (var intLoop = 1; intLoop < days.length-1; intLoop++) document.write("<TD class=calendarTd id=diary>" + days[intLoop] + "</TD>"); document.write("<TD class=calendarDaySat id=diary>" + days[intLoop] + "</TD>"); </SCRIPT> </TR> </thead> <TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()" onmouseup=document.selection.empty() oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()> <SCRIPT LANGUAGE="JavaScript"> for (var intWeeks = 0; intWeeks < 6; intWeeks++) { document.write("<TR style='cursor:hand'>"); for (var intDays = 0; intDays < days.length;intDays++) document.write("<TD class=calendarTd onMouseover='{classTemp=this.className;this.className=calendarHover}' onMouseOut='this.className=classTemp'></TD>"); document.write("</TR>"); } </SCRIPT> </tbody> </table> <script LANGUAGE="JavaScript"> Calendar(); </script> <!-- Blog日历表结束 --> <center><script language=JavaScript src="http://laoan.com/counters/count.php?jierry"></script></center><br> <table border="0" bordercolor="#000000" bgcolor="#F7F7F7" cellpadding="5" cellspacing="0" width="150"> <tr> <td style="border:1px dotted #999; "> </td> </tr> </table> </div>
文章分类
    友情blog
    !java
    火凤凰
    翱翔.Net Blog
    键者天行
    阿赖的个性空间
    站点收藏
    CSDN程序员网
    ITPUB论坛
    net130.com
    中国IT认证实验室
    中国UNIX技术社区
    中国互联网协会
    中国交换机网
    中国协议分析网
    中国教育产业联盟网
    中国电信技术
    中国系统分析员
    中国软考联盟
    中国通信网
    中国通信联盟论坛
    互联网在线
    天极网
    慧聪网
    拓普电子技术学习网
    术语详解
    李开复中国网
    系统分析员之窗
    网管员世界
    网络大典
    网络工程师联盟
    菊花论坛
    视频教学下载网
    赛迪网
    软件工程专家网
    存档

    原创  如何制作批处理文件 收藏

    简单来说:可以用记事本编辑,然后将后缀改为.bat

    后缀是bat的文件就是批处理文件,是一种文本文件。简单的说,它的作用就是自动的连续执行多条命令,批处理文件的内容就是一条一条的命令。那它有什么用呢?

    比如,在启动wps软件时,每次都必须执行

    C:\>cd wps
    C:\WPS>spdos
    C:\WPS>py
    C:\WPS>wbx
    C:\WPS>wps

    如果每次用WPS之前都这样执行一次,您是不是觉得很麻烦呢?

    如果有一个方法,只需编写一个批处理文件,就会自动执行刚才的所有命令,您想不想学呢?

    当您看完此节,自己编写的第一个批处理文件顺利执行时,您一定会大吃一惊的。

    此外电脑每次启动时都会寻找autoexec.bat这条批处理文件,从而可执行一些每次开机都要执行的命令,如设置路径path、加载鼠标驱动mouse、磁盘加速smartdrv等,可以使您的电脑真正自动化。

    echo、@、call、pause、rem 是批处理文件最常用的几个命令,我们就从他们开始学起。 echo 表示显示此命令后的字符
    echo off 表示在此语句后所有运行的命令都不显示命令行本身
    @ 与echo off相象,但它是加在其它命令行的最前面,表示运行时不显示命令行本身。
    call 调用另一条批处理文件(如果直接调用别的批处理文件 ,执行完那条文件后将无法执行当前文件后续命令)
    pause 运行此句会暂停,显示Press any key to continue... 等待用户按任意键后继续
    rem 表示此命令后的字符为解释行,不执行,只是给自己今后查找用的

    例:用edit编辑a.bat文件,输入下列内容后存盘为c:\a.bat,执行该批处理文件后可实现:将根目录中所有文件写入 a.txt中,启动UCDOS,进入WPS等功能。

    批处理文件的内容为: 文件表示:

    echo off 不显示命令行

    dir c:\*.* >a.txt 将c盘文件列表写入a.txt

    call c:\ucdos\ucdos.bat 调用ucdos

    echo 你好 显示"你好"

    pause 暂停,等待按键继续

    rem 使用wps 注释将使用wps

    cd ucdos 进入ucdos目录

    wps 使用wps

    批处理文件中还可以像C语言一样使用参数,这只需用到一个参数表示符%。

    %表示参数,参数是指在运行批处理文件时在文件名后加的字符串。变量可以从 %0到%9,%0表示文件名本身,字符串用%1到%9顺序表示。

    例如,C:根目录下一批处理文件名为f.bat,内容为 format %1

    则如果执行C:\>f a: 则实际执行的是format a:

    又如C:根目录下一批处理文件的名为t.bat,内容为 type %1 type %2

    那么运行C:\>t a.txt b.txt 将顺序地显示a.txt和b.txt文件的内容

    if goto choice for 是批处理文件中比较高级的命令,如果这几个你用得很熟练,你就是批处理文件的专家啦。

    if 表示将判断是否符合规定的条件,从而决定执行不同的命令。 有三种格式:
    1、if "参数" == "字符串" 待执行的命令
    参数如果等于指定的字符串,则条件成立,运行命令,否则运行下一句。(注意是两个等号)
    如if "%1"=="a" format a:

    2、if exist 文件名 待执行的命令
    如果有指定的文件,则条件成立,运行命令,否则运行下一句。如if exist config.sys edit config.sys

    3、if errorlevel 数字 待执行的命令
    如果返回码等于指定的数字,则条件成立,运行命令,否则运行下一句。如if errorlevel 2 goto x2 DOS程序运行时都会返回一个数字给DOS,称为错误码errorlevel或称返回码

    goto 批处理文件运行到这里将跳到goto 所指定的标号处, 一般与if配合使用。 如:

    goto end

    :end
    echo this is the end

    标号用 :字符串 表示,标号所在行不被执行

    choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234……

    如: choice /c:dme defrag,mem,end
    将显示
    defrag,mem,end[D,M,E]?

    例如,test.bat的内容如下:
    @echo off
    choice /c:dme defrag,mem,end
    if errorlevel 3 goto defrag 应先判断数值最高的错误码
    if errorlevel 2 goto mem
    if errotlevel 1 goto end

    :defrag
    c:\dos\defrag
    goto end

    :mem
    mem
    goto end

    :end
    echo good bye

    此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。

    for 循环命令,只要条件符合,它将多次执行同一命令。

    格式FOR [%%f] in (集合) DO [命令]
    只要参数f在指定的集合内,则条件成立,执行命令

    如果一条批处理文件中有一行:
    for %%c in (*.bat *.txt) do type %%c
    含义是如果是以bat或txt结尾的文件,则显示文件的内容。

    autoexec.bat

    DOS在启动会自动运行autoexec.bat这条文件,一般我们在里面装载每次必用的程序,如: path(设置路径)、smartdrv(磁盘加速)、 mouse(鼠标启动)、mscdex(光驱连接)、 doskey(键盘管理)、set(设置环境变量)等。

    如果启动盘根目录中没有这个文件,电脑会让用户输入日期和时间。

    例如,一个典型的autoexec.bat内容如下:

    @echo off 不显示命令行

    prompt $p$g 设置提示符前有目录提示

    path c:\dos;c:\;c:\windows;c:\ucdos;c:\tools 设置路径

    lh c:\dos\doskey.com 加载键盘管理

    lh c:\mouse\mouse.com 加载鼠标管理

    lh c:\dos\smartdrv.exe 加载磁盘加速管理

    lh c:\dos\mscdex /S /D:MSCD000 /M:12 /V 加载CD-ROM驱动

    set temp=c:\temp 设置临时目录
     

    发表于 @ 2006年08月30日 10:05:00 | 评论( loading... ) | 编辑| 举报| 收藏

    旧一篇:工作组和域的区别 | 新一篇:用注销脚本清除上网所留下的痕迹

    • 发表评论
    • 评论内容:
    •  
    Copyright © hust_wh
    Powered by CSDN Blog