1.什么是批处理文件?
2.Money spent on the brain is never spent in vain.
什么是批处理文件?
批处理,也称为批处理脚本,英文译为BATCH,批处理文件后缀BAT就取的前三个字母。它的构成没有固定格式,只要遵守以下这条就ok了:每一行可视为一个命令,二级建造师视频解析源码每个命令里可以含多条子命令,从第一行开始执行,直到最后一行结束,它运行的平台是DOS。批处理有一个很鲜明的特点:使用方便、灵活,功能强大,自动化程度高。我不想让自己写的教程枯燥无味,因为牵缠到代码(批处理的内容算是代码吧?)的问题本来就是枯燥的,很少有人能面对满屏幕的代码而静下心来。所以我会用很多简单实用的例子让读这篇教程的朋友去体会批处理的那四射的魅力,感受它那古灵精怪的性格,不知不觉中爱上批处理(晕,怎么又是爱?到底批处理和爱有什么关系?答案:没有!)。再说句“闲话”:要学好批处理,DOS基础一定要牢!当然脑子灵活也是很重要的一方面。
例一、先给出一个最easy的批处理脚本让大家和它混个脸熟,将下面的几行命令保存为name.bat然后执行(以后文中只给出代码,保存和执行方式类似):
ping sz.tencent.com > a.txt
ping sz1.tencent.com >> a.txt
ping sz2.tencent.com >> a.txt
ping sz3.tencent.com >> a.txt
ping sz4.tencent.com >> a.txt
ping sz5.tencent.com >> a.txt
ping sz6.tencent.com >> a.txt
ping sz7.tencent.com >> a.txt
exit
是不是都能看的懂?是不是很easy?但它的作用却是很实用的,执行这个批处理后,可以在你的当前盘建立一个名为a.txt的文件,它里面记录的信息可以帮助你迅速找到速度最快的QQ服务器,从而远离“从服务器中转”那一痛苦的过程。这里>的意思,是把前面命令得到的东西放到后面所给的地方,>>的作用,和>的相同,区别是把结果追加到前一行得出的结果的后面,具体的说是下一行,而前面一行命令得出的结果将保留,这样可以使这个a.txt文件越来越大(想到如何搞破坏了)。By the way,这个批处理还可以和其他命令结合,搞成完全自动化判断服务器速度的东东,执行后直接显示速度最快的服务器IP,是不是很爽?后面还将详细介绍。
例二、再给出一个已经过时的例子(a.bat):
@echo off
if exist C:\Progra~1\Tencent\AD\*.gif del C:\Progra~1\Tencent\AD\*.gif
a.bat
为什么说这是个过时的例子呢?很简单,因为现在已经几乎没有人用带广告的QQ了(KAO,我的QQ还显示好友三围呢!!),所以它几乎用不上了。但曾经它的作用是不可小窥的:删除QQ的广告,让对话框干干净净。这里用的地址是QQ的默认安装地址,默认批处理文件名为a.bat,你当然可以根据情况自行修改。在这个脚本中使用了if命令,使得它可以达到适时判断和删除广告的效果,你只需要不关闭命令执行后的DOS窗口,不按CTRL+C强行终止命令,它就一直监视是否有广告(QQ也再不断查看自己的广告是否被删除)。当然这个脚本占用你一点点内存,呵呵。nginx的底层源码
例三,使用批处理脚本查是否中冰河。脚本内容如下:
@echo off
netstat -a -n > a.txt
type a.txt | find "" && echo "Congratulations! You have infected GLACIER!"
del a.txt
pause & exit
这里利用了netstat命令,检查所有的网络端口状态,只需要你清楚常见木马所使用的端口,就能很easy的判断出来是否被人种了冰河。然这不是确定的,因为冰河默认的端口,完全可以被人修改。这里介绍的只是方法和思路。这里介绍的是方法和思路稍做改动,就变成可以检查其他木马的脚本了,再改动一下,加进去参数和端口及信息列表文件后,就变成自动检测所有木马的脚本了。呵呵,是不是很过瘾?脚本中还利用了组合命令&&和管道命令|,后面将详细介绍。
例四,借批处理自动清除系统垃圾,脚本如下:
@echo off
if exist c:\windows\temp\*.* del c:\windows\temp\*.*
if exist c:\windows\Tempor~1\*.* del c:\windows\Tempor~1\*.*
if exist c:\windows\History\*.* del c:\windows\History\*.*
if exist c:\windows\recent\*.* del c:\windows\recent\*.*
将以上脚本内容保存到autoexec.bat里,每次开机时就把系统垃圾给自动删除了。这里需要注意两点:一、DOS不支持长文件名,所以就出现了Tempor~1这个东东;二、可根据自己的实际情况进行改动,使其符合自己的要求。
怎么样,看到这里,你对批处理脚本是不是已经有点兴趣了?是不是发现自己已经慢慢爱上了这个东东?别高兴的太早,爱不是一件简单的事,它也许能带给你快乐和幸福,当然也能让你痛苦的想去跳楼。如果你知道很难还敢继续的话,I 服了 YOU!继续努力吧,也许到最后你不一定得到真爱(真的有这可能,爱过的人都知道),但你可以体会到整个爱的过程,就是如此。 酸、苦和辣,有没有甜天知道。
为什么会把批处理和爱情扯上关系?不是我无聊,也不是因为这样写有趣多少,原因有二:其一,批处理和爱情有很多相同的地方,有些地方我用“专业”的行话解释不清(我不怀疑自己的表达能力,而是事情本身就不好说清楚),说了=没说,但用地球人都知道的爱情一比喻(爱情是什么?我**怎么知道!!),没准你心里一下就亮堂了,事半功倍,何乐而不为?其二,我这段时间状态不是很好,感冒发烧头疼鼻塞,但主要还是感情上精神摧残,搞的人烦透了,借写教程之际感慨几句,大家就全当买狗皮膏药了,完全可以省略不看(也许还真有点效果----不至于让你看着看着就睡着了,把头磕了来找我报销医药费)。debug异常分析源码说不定下次的教程中大家还会看到杨过、张无忌等金老前辈笔下的英雄们。
看过第一章的朋友,一定对批处理有了初步的印象,知道它到底是用来干什么的了。但你知道运用批处理的精髓在哪里吗?其实很简单:思路要灵活!没有做不到的,只有想不到的。这和爱情就有点不同了,因为爱情的世界是两个人的世界,一厢情愿不叫爱情(补充:那叫单恋。废话!)而批处理却是一个人的天堂,你可以为所欲为,没有达不到的境界!
批处理看起来杂乱无章,但它的逻辑性之强,绝对不比其他程序语言(如汇编)低,如果你写的脚本是一堆乱麻,虽然每一行命令都正确,但从头执行到尾后,不一定得到你想要的结果,也许是一屏幕的Bad command or fail name。这又和爱情有了共同点:按步骤来经营,缺少或增多的步骤都可能导致不想看见的结果。陷入爱河的朋友,相信没有不肯定这句话的。我的爱情批处理,输出的结果不是Bad command or fail name,屏幕是这么显示的:‘你的爱情’不是内部或外部命令,也不是可运行的程序或批处理文件。然后就是光标不停闪动,等待这下一次错误的输入。
从这一章开始,将由浅入深的介绍批处理中常用的命令,很多常见DOS命令在批处理脚本中有这广泛的应用,它们是批处理脚本的BODY部分,但批处理比DOS更灵活多样,更具备自动化。要学好批处理,DOS一定要有比较扎实的基础。这里只讲述一些比较少用(相对来说)的DOS命令,常用命令如COPY、DIR等就不做介绍了(这些看似简单的命令实际复杂的很,我怕自己都说不清楚!)。
例五,先看一个实例。这是一个很有意思的脚本,一个小巧实用的好东东,把批处理“自动化”的特点体现的淋漓尽致。先介绍一下这个脚本的来历:大家都知道汇编程序(MASM)的上机过程,先要对源代码进行汇编、连接,然后再执行,而这中间有很多环节需要输入很多东西,麻烦的很(只有经历过的朋友才懂得)。如何使这个过程变的简单呢?在我们搞汇编课程设计时,我“被逼”写了这个脚本,用起来很爽,呵呵。看看脚本内容:
@echo off
::close echo
cls
::clean screen
echo This programme is to make the MASM programme automate
::display info
echo Edit by CODERED
::display info
echo Mailto me : qqkiller***@sina.com
::display info
if "%1"=="" goto usage
::if input without paramater goto usage
if "%1"=="/?" goto usage
::if paramater is "/?" goto usage
if "%1"=="help" goto usage
::if paramater is "help" goto usage
pause
::pause to see usage
masm %1.asm
::assemble the .asm code
if errorlevel 1 pause & edit %1.asm
::if error pause to see error msg and edit the code
link %1.obj & %1
::else link the .obj file and execute the .exe file
:usage
::set usage
echo Usage: This BAT file name [asm file name]
echo Default BAT file name is START.BAT
::display usage
先不要被这一堆的东西给吓怕了,静下心来仔细的看(回想一下第一章中第一段是怎么写的!!php手机抽奖源码)。已经给出了每一行命令的解释,两个冒号后面的内容为前一行内容解释的E文(害怕E文的朋友也不用担心,都很easy,一看就懂了,实在不懂了不会查词典啊,这么懒?),在脚本执行时不显示,也不起任何作用。倒数第5行行首有一个冒号,可不是笔误哦!具体作用后面会详细讲到。此脚本中masm和link是汇编程序和连接程序,必须和edit程序以及你要编辑的源代码(当然还有这个脚本,废话!)一起在当前目录中。使用这个批处理脚本,可以最大可能的减少手工输入,整个过程中只需要按几下回车键,即可实现从汇编源代码到可执行exe文件的自动化转换,并具备智能判断功能:如果汇编时源代码出现错误(汇编不成功),则自动暂停显示错误信息,并在按任意键后自动进入编辑源代码界面;如果源代码汇编成功,则进行连接,并在连接后自动执行生成的exe文件。另外,由于批处理命令的简单性和灵活性,这个脚本还具备良好的可改进性,简单进行修改就可以符合不同朋友的上机习惯。正在学汇编的朋友,一定别忘了实习一下!
在这个脚本中出现了如下几个命令:@、echo、::、pause、:和goto、%以及if。而这一章就将讲述这几个命令。
1、@
这个符号大家都不陌生,email的必备符号,它怎么会跑到批处理中呢?呵呵,不是它的错,批处理本来就离不开它,要不就不完美了。它的作用是让执行窗口中不显示它后面这一行的命令本身(多么绕口的一句话!)。呵呵,通俗一点说,行首有了它的话,这一行的命令就不显示了。在例五中,首行的@echo off中,@的作用就是让脚本在执行时不显示后面的echo off部分。这下懂了吧?还是不太懂?没关系,看完echo命令简介,自然就懂了。
2、echo
中文为“反馈”、“回显”的意思。它其实是一个开关命令,就是说它只有两种状态:打开和关闭。于是就有了echo on和echo off两个命令了。直接执行echo命令将显示当前echo命令状态(off或on)执行echo off将关闭回显,邮箱源码按钮在哪它后面的所有命令都不显示命令本身,只显示执行后的结果,除非执行echo on命令。在例五中,首行的@命令和echo off命令联合起来,达到了两个目的:不显示echo off命令本身,不显示以后各行中的命令本身。的确是有点乱,但你要是练习一下的话,3分钟包会,不会的退钱!
echo命令的另一种用法一:可以用它来显示信息!如例五中倒数第二行,Default BAT file name is START.BAT将在脚本执行后的窗口中显示,而echo命令本身不显示(为什么)。
echo命令的另一种用法二:可以直接编辑文本文件。例六:
echo nbtstat -A ..0.1 > a.bat
echo nbtstat -A ..0.2 >> a.bat
echo nbtstat -A ..0.3 >> a.bat
以上脚本内容的编辑方法是,直接是命令行输入,每行一回车。最后就会在当前目录下生成一个a.bat的文件,直接执行就会得到结果。
3、::
这个命令的作用很简单,它是注释命令,在批处理脚本中和rem命令等效。它后面的内容在执行时不显示,也不起任何作用,因为它只是注释,只是增加了脚本的可读性,和C语言中的/*…………*/类似。地球人都能看懂,就不多说了。
4、pause
中文为“暂停”的意思(看看你的workman上),我一直认为它是批处理中最简单的一个命令,单纯、实用。它的作用,是让当前程序进程暂停一下,并显示一行信息:请按任意键继续. . .。在例五中这个命令运用了两次,第一次的作用是让使用者看清楚程序信息,第二个是显示错误的汇编代码信息(其实不是它想显示,而是masm程序在显示错误信息时被暂它停了,以便让你看清楚你的源代码错在哪里)。
5、:和goto
为什么要把这两个命令联合起来介绍?因为它们是分不开的,无论少了哪个或多了哪个都会出错。goto是个跳转命令,:是一个标签。当程序运行到goto时,将自动跳转到:定义的部分去执行了(是不是分不开?)。例五中倒数第5行行首出现一个:,则程序在运行到goto时就自动跳转到:标签定义的部分执行,结果是显示脚本usage(usage就是标签名称)。不难看出,goto命令就是根据这个冒号和标签名称来寻找它该跳转的地方,它们是一一对应的关系。goto命令也经常和if命令结合使用。至于这两个命令具体用法,参照例五。
goto命令的另一种用法一:提前结束程序。在程序中间使用goto命令跳转到某一标签,而这一标签的内容却定义为退出。如:
……
goto end
……
:end
这里:end在脚本最后一行!其实这个例子很弱智,后面讲了if命令和组合命令你就知道了。
6、%
这个百分号严格来说是算不上命令的,它只是批处理中的参数而已(多个%一起使用的情况除外,以后还将详细介绍),但千万别以为它只是参数就小看了它(看看例五中有多少地方用到它?),少了它批处理的功能就减少了%了。看看例七:
net use \\%1\ipc$ %3 /u:"%2"
copy .BAT \\%1\admin$\system /y
copy .BAT \\%1\admin$\system /y
copy ipc2.BAT \\%1\admin$\system /y
copy NWZI.EXE \\%1\admin$\system /y
attrib \\%1\admin$\system\.bat -r -h -s
以上代码是Bat.Worm.Muma病毒中的一部分,%1代表的IP,2%代表的username,3%代表password。执行形式为:脚本文件名 参数一 参数二 ……。假设这个脚本被保存为a.bat,则执行形式如下:a IP username password。这里IP、username、password是三个参数,缺一不可(因为程序不能正确运行,并不是因为少了参数语法就不对)这样在脚本执行过程中,脚本就自动用用你的三个参数依次(记住,是依次!也是一一对应的关系。)代换1%、2%和3%,这样就达到了灵活运用的目的(试想,如果在脚本中直接把IP、username和password都定义死,那么脚本的作用也就被固定了,但如果使用%的话,不同的参数可以达到不同的目的,是不是更灵活?)。
关于这个参数的使用,在后续章节中还将介绍。一定要非常熟练才行,这需要很多练习过程,需要下点狠工夫!
这一章就写到这里了。可能有朋友问了:怎么没介绍if命令?呵呵,不是我忘了,而是它不容易说清楚,下一章再讲了!这一章讲的这点东西,如果你是初学者,恐怕也够消化的了。记住一句话:DOS是批处理的BODY,任何一个DOS命令都可以被用在批处理脚本中去完成特定的功能。到这里,你是否已经想到了用自己肚子里的东西去写点带有自动化色彩的东东呢?很简单,就是一个DOS命令的集合而已,相信自称为天才的你已经会把计算机等级考试上机试题中的DOS部分用批处理来自动化完成了。
烦!就好象一个半老女人到了更年期,什么事都想唠叨几句,什么事都感到不舒服,看谁谁不爽。明知山有虎,偏向虎山行,最后留下一身伤痕无功而返时,才发现自己竟然如此脆弱,如此渺小,如此不堪一击。徘徊在崩溃的边缘,突然回想起了自己最后一次扁人的那一刻,还真有点怀念(其实我很不喜欢扁人,更不喜欢被人扁)。我需要发泄,我用手指拼命的敲打着键盘,在一阵接一阵有节奏的声音中,屏幕上出现了上面的这些文字。可难道这就是发泄的另一种方式吗?中国人还是厉害,早在几千年前孔老夫子就说过“唯女子与小人,难养也”,真**有先见之明,佩服!虽然是在发泄,不过大家请放心,以我的脾气,既然决定写这篇教程,就一定会尽力去写好,写完美,绝对不给自己留下遗憾,要不这教程就不是我写的!
曾经有一篇经典的批处理教程出现在你的屏幕上,你没有保存,直到找不到它的链接你才后悔莫及,人世间最大的痛苦莫过于此。如果上天能给你一个再看一次的机会,你会对那篇教程说三个字:我爱你!如果非要给这份爱加上一个期限,你希望是年。因为年后,你恐怕早已经挂了!而现在,你的屏幕上出现了这篇你正在看的批处理教程,虽然不如你曾经看的那篇经典,但如果勉强还过的去。你会爱它吗?时间会有年那么长吗?答案是:试试看吧。
批处理脚本中最重要的几个命令,将在这一章详细介绍,但是很遗憾,有些细节到现在我都没掌握的很好,甚至还有些生分。如同还不太懂得爱一样。但我一直都在努力,即使一直都没有收获。所以可能讲的会比较笼统,但我会告诉你方法,剩下的就是时间问题了,需要自己去磨练。让我们共同努力吧。冰冻三尺非一日之寒,滴水穿石非一日之功。有些事情,比如学批处理,比如爱一个人,都是不能速成的,甚至还会有付出艰辛而收获为甚微的情况。再次重申,看这篇教程的时候,一定要静下心来,除非你已经掌握了这篇教程的所有东西----但那也就不必看了,浪费时间!
7、if
接上一章,接着讲if命令。总的来说,if命令是一个表示判断的命令,根据得出的每一个结果,它都可以对应一个相应的操作。关于它的三种用法,在这里分开讲。
(1)、输入判断。还是用例五里面的那几句吧:
if "%1"=="" goto usage
if "%1"=="/?" goto usage
if "%1"=="help" goto usage
这里判断输入的参数情况,如果参数为空(无参数),则跳转到usage;如果参数为/?或help时(大家一般看一个命令的帮助,是不是输入的/?或help呢,这里这么做只是为了让这个脚本看起来更像一个真正的程序),也跳转到usage。这里还可以用否定形式来表示“不等于”,例如:if not "%1"=="" goto usage,则表示如果输入参数不为空就跳转到usage(实际中这样做就没意义了,这里介绍用法,管不了那么多了,呵呵。)是不是很简单?其实翻译成中文体会一下就understand了。
(2)、存在判断。再看例二里这句:
if exist C:\Progra~1\Tencent\AD\*.gif del C:\Progra~1\Tencent\AD\*.gif
如果存在那些gif文件,就删除这些文件。当然还有例四,都是一样的道理。注意,这里的条件判断是判断存在的,当然也可以判断不存在的,例如下面这句“如果不存在那些gif文件则退出脚本”:if not exist C:\Progra~1\Tencent\AD\*.gif exit。只是多一个not来表示否定而已。
(3)、结果判断。还是拿例五开刀(没想到自己写的脚本,竟然用处这么大,呵呵):
masm %1.asm
if errorlevel 1 pause & edit %1.asm
link %1.obj
先对源代码进行汇编,如果失败则暂停显示错误信息,并在按任意键后自动进入编辑界面;否则用link程序连接生成的obj文件。这里只介绍一下和if命令有关的地方,&命令后面会讲到。这种用法是先判断前一个命令执行后的返回码(也叫错误码,DOS程序在运行完后都有返回码),如果和定义的错误码符合(这里定义的错误码为1),则执行相应的操作(这里相应的操作为pause & edit %1.asm部分)。
另外,和其他两种用法一样,这种用法也可以表示否定。用否定的形式仍表达上面三句的意思,代码变为:
masm %1.asm
if not errorlevel 1 link %1.obj
pause & edit %1.asm
看到本质了吧?其实只是把结果判断后所执行的命令互换了一下,“if not errorlevel 1”和“if errorlevel 0”的效果是等效的,都表示上一句masm命令执行成功(因为它是错误判断,而且返回码为0,0就表示否定,就是说这个错误不存在,就是说masm执行成功)。这里是否加not,错误码到底用0还是1,是值得考虑的两个问题,一旦搭配不成功脚本就肯定出错,所以一定要体会的很深刻才行。如何体会的深刻?练习!自己写一个脚本,然后把有not和没有not的情况,返回码为0或1的情况分别写进去执行(怎么,嫌麻烦啊?排列组合算一下才四中情况你就嫌麻烦了?后面介绍管道命令和组合命令时还有更麻烦的呢!怕了?呵呵。),这样从执行的结果中就能很清楚的看出这两种情况的区别。
这种用errorlevel结果判断的用法是if命令最难的用法,但也恰恰是最有用的用法,如果你不会用errorlevel来判断返回码,则要达到相同的效果,必须用else来表示“否则”的操作,是比较麻烦的。以上代码必须变成:
masm %1.asm
if exist %1.obj link %1.obj
else pause & edit %1.asm
关于if命令的这三种用法就say到这里,理解很简单,但应用时就不一定用的那么得心应手,主要是熟练程度的问题。可能有的朋友有点惊讶,我怎么没给出类似下面三行的用法介绍,是因为下面三行是if命令帮助里对它自身用法的解释,任何人只要一个“if /?”就能看到,我没有必要在这里多费口舌;更重要的原因,是我觉得这样介绍的不清楚,看的人不一定看的懂,所以我采用上面自己对if命令的理解来介绍。一定要注意的是,这三种用法的格式各不相同,而且也是不能改变的,但实际上可以互换(以为从本质上讲,这三种用法都是建立在判断的基础上的,哲学教我们学会透过现象看事物本质!)。有兴趣的朋友可以自己研究一下。
IF [NOT] ERRORLEVEL number do command
IF [NOT] string1==string2 do command
IF [NOT] EXIST filename do command
8、call
学过汇编或C的朋友,肯定都知道call指令表示什么意思了,在这里它的意思其实也是一样的。在批处理脚本中,call命令用来从一个批处理脚本中调用另一个批处理脚本。看例八(默认的三个脚本文件名分别为start.bat、.bat和ipc.bat):
start.bat:
……
CALL .BAT 0
……
.bat:
……
ECHO %IPA%.%1 >HFIND.TMP
……
CALL ipc.bat IPCFind.txt
ipc.bat:
for /f "tokens=1,2,3 delims= " %%i in (%1) do call HACK.bat %%i %%j %%k
有没有看出什么不对的地方?没看出来啊?没看出来就对了,其实就没有不对的地方嘛,你怎么看的出来!从上面两个脚本,你可以得到如下信息:1、脚本调用可以灵活运用,循环运用、重复运用。2、脚本调用可以使用参数!关于第一点就不多说了,聪明的你一看就应该会,这里说一下第二点。
在start.bat中,.bat后面跟了参数0,在执行时的效果,其实就是把.bat里的参数%1用0代替。在start.bat中,ipc.bat后面跟了参数ipcfind.txt(一个文件,也可以做参数),执行时的效果,就是用ipc.bat中的每一行的三个变量(这里不懂没关系,学过for命令后就懂了),对应代换ipc.bat中的%%i、%%j和%%k。这里参数调用是非常灵活的,使用时需要好好体会。在初学期间,可以先学习只调用脚本,至于连脚本的参数一起使用的情况,在后面的学习中自然就会有比较深刻的理解,这是因为当你已经可以灵活运用批处理脚本后,如何使代码写的更精简更完美更高效就自然包括到了考虑的范围,这时候你就会发现在调用脚本时直接加入参数,可以使代码效率加倍。By the way,上面的这几个脚本,都是Bat.Worm.Muma病毒的一部分,在后面的教程里,大家将有机会见到这个病毒的真面目。
那是不是说,在同一个目录下至少存在两个批处理脚本文件(只有一个你调用谁?)?呵呵,注意了,这句话错了!!只有一个照样可以调用----调用自身!看例九(默认脚本文件名a.bat):
net send %1 This is a call example.
call a.bat
这两句一结合,效果自然不怎么样,因为只有一台机器来发消息,谁怕谁啊?我给你来个礼尚往来!可如果有台机器同时执行,而且每台机器开和窗口同时向一个目标机器发消息的话,呵呵。这里call a.bat的作用就是调用自身,执行完前一句net send命令后再调用自身,达到了循环执行的目的。
给出一个很有意思的脚本,有兴趣的朋友可以实验一下。例十(默认脚本文件名为a.bat):
call a.bat
一定要在DOS窗口下执行,否则只会看到一个窗口一闪而过,看不到最后结果。等执行完后,当脚本被执行了次,别忘了想一下到底是为什么!爱情有时候跟这个脚本一样,一旦陷入死循环,最后的结果都是意想不到的。只是爱情,绝对不会等到被毫无理由的循环这么多次,也许在第三次时就出现了love is aborted的提示。
9、find
这是一个搜索命令,用来在文件中搜索特定字符串,通常也作为条件判断的铺垫程序(我怎么突然想起了这四个字?)。这个命令单独使用的情况在批处理中是比较少见的,因为没什么实际意义。还是借例三来说明:
@echo off
netstat -a -n > a.txt
type a.txt | find "" && echo "Congratulations! You have infected GLACIER!"
del a.txt
pause & exit
先用netstat命令检查是否有冰河默认的端口在活动,并把结果保存到a.txt中。然后使用type命令列出a.txt中的内容,再在列出的内容中搜索字符串“” ,发现有的话则提示中了冰河,否则退出。看,find命令其实就这么简单,但有一点必须要注意到:如果不使用type命令列出a.txt中的内容,而是直接使用find命令在a.txt中找“”(find a.txt "" && echo "Congratulations! You have infected GLACIER!"),就必须得给
Money spent on the brain is never spent in vain.
1,æºåæèµç»ä¸ä¼ç½è±
è±è¯å人åè¨- ç¾æèµæ- è±è¯å¦ä¹ - ç ´éæ²è: æºç ä¸è½½,ç´ æä¸è½½,为 ...
/forum/viewtopic.php?t=
3,ç¨äºæè²çé±ç»ä¸æ¯èæ·.
æ¯æ¥ä¸å¥
/s/html/-/.htm
4,æºåä¸çæèµç»é浪费ã
LCES READER EZ GO | å人è°è¯åè¨å½PartM
e to the kingdom which God has given thee for such a time as this, when there is need of thee and all that thou hast?
Next, notice that the servants of God--whether called ministers or not,- those who are really so, are stewards because they are under the Masterâs near command. An ordinary servant in Godâs house may take his orders from the steward, but the steward takes no order from anybody but the Master; and hence, he is in an evil case, and the household is in an evil case, too, if he does not often resort to the Master, if he does not distinctly recognize his position as an underling of his Master, and if he does not so keep up his daily fellowship with the Master that he himself knows the Masterâs mind, and is able to communicate it to his fellow-servants.
The real steward is one who has been appointed to the position; and if he is not appointed, why, he has no right to be a steward at all! Things go right when there is no absentee landlord, but when the great Master is always close at hand, and the steward constantly goes to him with an account of all his work. The steward keeps his masterâs stores, and sees that they are not wasted; but he takes care also to magnify his masterâs liberality by seeing that none of the household know any want. I have known some who pretended to be stewards of Christ who evidently did not understand the business.
First, give an account of the stewardship of thy time. How hast thou spent it? Have not many hours been allowed to run to waste, or worse than waste, in frivolity and sin? Hast thou lived as a dying man should live? Hast thou employed thine hours as remembering that they are very few, and more precious than the diamonds in an emperorâs crown? What about thy time? Has there not been much of it spent in indolence, in frothy talk, or that did not minister to edification? Thou needest not accuse thyself for time spent in lawful recreation that may sustain thy body, and fit it better for the Lordâs service.
But, after all, to every man, whether he be rich, or whether he be in the office of the ministry, there may be a close of his stewardship before he dies. The mother has her little children swept away one after another; this is the message to her, âThou mayest be no longer steward.â The teacher has his class scattered, or he is himself unable to go to the school; the word to him also is, âThou mayest be no longer steward.â The man who went to his work, who might have spoken to his fellow-workman, is removed, perhaps to another land, or he is placed in a position where his mouth is shut; now he can be no longer steward. Use all opportunities while you have them, catch them on the wing, serve God while you can today! today! today! today! Let each golden moment have its pressing service rendered unto God, lest it should be said to thee, âThou mayest be no longer steward.â
Now, as Peter found this prayer so suitable for him, I commend it to each one of you. Have; you been growing rich lately? Then, you will be tempted to become proud and worldly; so pray, âLord, save me from the evils that, so often go, with riches; thou art giving me this wealth, help me to be a good steward of it, and not to make, an idol of it.â Or are you getting poor? Is your business proving a failure? Are your little savings almost gone? Well, there are perils connected with poverty; so pray, âLord, save me from becoming envious or discontented; let me be willing to be poor rather than do anything wrong in order to get money.â
First, a steward is a servant, and no more. Perhaps he does not always remember this; and it is a very pitiful Business when the servant begins to think that he is âmy lord.â It is a pity that servants when honored by their master should be so apt to give themselves airs. How ridiculous Jack-inoffice makes himself! I do not refer now to butlers and footmen, but to ourselves. If we magnify ourselves, we shall become contemptible, and we shall neither magnify our office nor our Lord. We are the servants of Christ, and not lords over his heritage.
My friend, keep money in thy purse: âIt is one of Solomonâs proverbs,â said one; another answered that it was not there. âThen,â said Kit Lancaster, âit might have been, and if Solomon had ever known the miss of a shilling he would have said it seven times over.â I think that he does say as much as this in substance, if not in so many words, especially when he talks about the ant; but be that how it may, be sure of this, that a pound in the pocket is as good as a friend at court, and rather better; and if ever you live to want what you once wasted, it will fill you with woe enough to last you to your grave. He who put a pound of butter on a gridiron, not only lost his butter, but made such a blaze as he wonât soon forget: foolish lavishness leads to dreadful wickedness, so John Ploughman begs all his mates to fight shy of it, and post off to the Post Office Savingsâ Bank. âFor age and want save while you may; No morningâs sun lasts all the day.â Money is not the chief thing, it is as far below the grace of God and faith in Christ as a ploughed field is below the stars; but still, godliness hath the promise of the life that now is; as well as of that which is to come, and he who is wise enough to seek first the kingdom of God and his righteousness, should also be wise enough to use aright the other things which God is pleased to add unto him.
âBlessed shall be thy basket and thy storeâ Deuteronomy :5 Obedience brings a blessing on all the provisions which our industry earns for us. That which comes in and goes out at once, like fruit in the basket which is for immediate use, shall be blest; and that which is laid by with us for a longer season shall equally receive a blessing. Perhaps ours is a handbasket portion. We have a little for breakfast, and a scanty bite for dinner in a basket when we go out to do our work in the morning. This is well, for the blessing of God is promised to the basket. If we live from hand to mouth, getting each dayâs supply in the day, we are as well off as Israel; for when the Lord entertained His favored people He Only gave them a dayâs manna at a time. What more did they need? What more do we need? But if we have a store, how much we need the Lord to bless it! For there is the care of getting, the care of keeping, the care of managing, the care of using; and, unless the Lord bless it, these cares will eat into our hearts, till our goods become our gods, and our cares prove cankers. O Lord, bless our substance. Enable us to use it for thy glory. Help us to keep worldly things in their proper places, and never may our savings endanger the saving of our souls.
Donât put all your eggs into one basket. It is unwise to risk all that you have in any one concern. If you have any savings, put them in several places. The marine form of this saying is: âDo not ship all your goods in one vessel.â
Many can get money; few can use it well. Even to keep it is not easy. Many of the silliest investments have been made by men who, in their own business, were shrewd to the highest degree. It is harder to weave than to gather wool.
Many save their silver, but lose their souls. Many a manâs soul has been ruined by his great love of money, although he had but little money to love.
Money borrowed is soon sorrowed. He that lends it begins to sorrow, even if the borrower does not; for, in general, he may mourn that he has parted from it to meet no more.
Money burns many. They are injured by their wealth. Some by bribes are burned; for when moneyâs taken, Freedomâs forsaken.
Money calls, but does not stay; It is round and rolls away. It makes the mill to go, but it goes faster than the mill-wheel. It is no more to be kept in the purse than snow in an oven; at least, so I find it. But why should we wish it to stay? It is the circulating medium! why should we detain it? If it rests it rusts. Let it go about doing good.
Money gained on Sabbath-day is a loss, I dare to say. No blessing can come with that which comes to us, on the devilâs back, by our willful disobedience of Godâs law. The loss of health by neglect of rest, and the loss of soul by neglect of hearing the gospel, soon turn all seeming profit into real loss.
Money gilds over guilt. Money is said to be a composition for taking out stains in character; but, in that capacity, it is a failure. Those characters which can be thus gilded must surely be of the gingerbread order.
Money has no blood relations. There is no friendship in business. Sad that this should be a proverb in any land, but so it is. The Chinese say: âThough brothers are closely akin, it is each for himself in money matters.â They also say: âTop and bottom teeth sometimes come into awkward collision.â So little power has relationship in the savage customs of business that, in some instances, one hand would skin the other, if it could make a profit by it.
Money is a good servant, but a bad master. Even as a servant it is not easy to keep it in due subordination. If âmoney makes dogs dance,â it makes men proud. If we make money our god, it will rule us like the devil.
Money is often lost for want of money. It is so when men cannot get their rights, from inability to pay legal charges. Yet if one had plenty of cash, it would not be wise to throw away good money after bad, Money is the best bait to fish for man with. He bites greedily at a gold or silver bait: but is the creature which is thus taken worth the catching? He who can be bought, I think is worth nought.
Money is the servant of the wise, and the master of fools. Money makes money. The goose that lays the golden eggs likes to lay where there are eggs already; perhaps because it is a goose. The lard comes to the fat; hog. Capital grows by interest, or by wise use it brings in profit, and thus increases.
Money is moneyâs brother. âIf riches increase, set not your heart upon them.â â Psalm :. Money makes the mare to go and the dog to dance. Pecuniae obediunt omnia.â All things obey money.â This saying comes from the Latin, but it is true in English. A little palm oil will gain entrance where nothing else will do it. Officials are greatly mollified when their hands are, crossed with silver. In a more allowable sense, a good wife would be happier and more active if her allowance could be increased. If she has too little money to keep house upon, it takes the âgoâ out of her. Money often unmakes the men who make it. It has a defiling and degrading power over the mind which thinks too much of it. âMoney and men a mutual falsehood show; Men make false money; money makes men so.â
Money speaks more powerfully than eloquence. Too often, because the speaker is a rich man he commands attention, and secures the approbation of persons who see no sound sense spoken by one who has no money bags. This is very well put in the following verse: â The man of means is eloquent: Brave, handsome, noble, wise; All qualities with gold are, sent, And vanish where it flies.
Money spent on the brain is never spent in vain. Pour your money into your brain, and you will never lose it all. Education is such a gain, that it is worth all that it costs, and more. Yet some fellows learn nothing in the schools. Many a father, when his son returns from the University, might say, âI put in gold into the furnace, and there came out this calf.â
Money will make the pot boil, though the devil should pour water on the fire. But such fuel is not to be depended on. We need something better than mere money to keep our pot a-boiling. Such boiling is apt to scald a man sooner or later.
Money wins where merit fails. It is a pity it should be so; but, with worldly minds, to be rich is to be good. This vulgar error is long in dying. âThe boy in yellow wins the day.â Canaries are still the favorite birds.
A hammer of gold will not open the gate of heaven. Money opens many of the gates of earth, for bribery is rife; but it has no power in the world to come. Money is more eloquent than ten members of parliament, but it cannot prevail with the Great Judge.
Better a purse empty than full of other menâs money. Gaining riches by chicanery is drawing down a curse upon ourselves. Honorable poverty is infinitely to be preferred to dishonest wealth, or to large indebtedness. In the Telugu we read: âA cupful of rice-water without debt is enough.â
Do good with your money, or it will do you no good. There is no power in it of itself to do real good to you. It may even do you evil; but, if used for God and his cause, and the poor, it will bless yourself.
æ»åèï¼
/search?num=&hl=zh-CN&newwindow=1&q=Money+spent+on+the+brain+is+never+spent+in+vain.&lr=