MRT 批处理命令详解(附加代码)
批处理命令大全及使用方法

批处理命令大全及使用方法批处理命令大全.Echo 命令打开回显或关闭请求回显功能,或显示消息。
如果没有任何参数,echo 命令将显示当前回显设置。
语法echo [{on|off}] [message]Sample:echo off / echo hello world在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。
2.@ 命令表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。
Sample:@echo off@echo Now initializing the program,please wait a minite...@format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y 是一样的。
)3.Goto 命令指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。
语法:goto label (label是参数,指定所要转向的批处理程序中的行。
)Sample:if {%1}=={} goto noparmsif {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。
)@Rem check parameters if null show usage:noparmsecho Usage: monitor.bat ServerIP PortNumbergoto end标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。
最好有一些说明这样你别人看起来才会理解你的意图啊。
4.Rem 命令注释命令,在C语言中相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。
【珍藏】批处理常用指令([col...

【珍藏】批处理常用指令([collection] common instructions forbatch processing)BAT command Daquan@ # single back offEcho off # began to close back from the next line@echo off # began to close back from the bank. This is the first line of general batch processingEcho on # began to open to the next lineEcho echo off is # displays the current state or echo state onEcho. # output a blank line, "enter"# (echo, echo; echo+ echo[echo] echo/ echo\)2 errorlevelEcho%errorlevel%Each command is run and you can view the return code in this command line formatThe default value is 0, and the general command error is set to errorlevel 13 dirDir # displays the current directory files and subdirectories.Dir /a # display in the current directory files and subdirectories, including hidden and system filesDir c: /a:d # display C in the current directory directory Dir c: /a:-d # display root directory C filesDir c:\ /b/p #/b displays only the file name, and the /p paging displayDir *.exe /s # display the current directory and all the subdirectories.Exe file4 CDCd\ # into the root directoryCD # displays the current directoryCD /d d:\sdk # can also change the drive and directory5 MDMD d:\a\b\c # if d:\a does not exist, it will automatically create the intermediate directoryIf # command extensions are disabled, you need to type MKDIR \a\b\c.6 RdRd ABC # delete the current directory ABC directory, for empty directoryRd /s/q d:\temp # delete the d:\temp folder and subfolders and files, /q quiet mode7 delDel d:\test.txt # deletefile, cannot be hidden, and read-only file systemDel /q/a/f d:\temp\*.*Delete all files inside the d:\temp folder, including hidden, read-only, system files, not subdirectoriesDel /q/a/f/s d:\temp\*.*Delete all files in the d:\temp and subfolders, including hidden, read-only, system files, not subdirectories8 RenRen d:\temp TMP # support to rename folder9 CLSClear the screen10 typeDisplay file contentsType c:\boot.ini # displays the contents of the specified file, the program files usually garbledType *.txt # display all.Txt files in the current directory contents11 copyCopy fileCopy c:\test.txt d:\test.bakCopy the c:\test.txt file to d:\ and rename it to test.bakCopy con test.txtFrom the screen, wait for the input, press Ctrl+Z to end the input, and save the input as a test.txt fileCon stands for screen, PRN stands for printer, and nul stands for empty deviceCopy 1.txt + 2.txt 3.txtMerge the contents of 1.txt and 2.txt and save it as a 3.txt fileIf no 3.txt is specified, then save to 1.txtCopy test.txt +Copying files to themselves is actually modifying the file date12 titleSet the title of the CMD windowTitle New Title # CMD can see the title bar of the window changed.13 verDisplay system version14 label and VolSet the labelVol # display labelLabel # display label, also prompted the new labelLabel c:system # set C label for system15 pausePause command16 REM and::Comment commandThe comment line does not perform the operation17 date and timeDate and timeDate # displays the current date, and prompted a new input date, press "enter" skipDate/t # only displays the current date, not prompt the new dateTime # displays the current time, and prompt new input time, press "enter" skipTime/t # only display the current time, not prompted to enter a new time18 goto and:Jump commandLabel: the # said it is tag line, the tag line does not perform the operationGoto label # jump to the specified label that line19 find (external command)Find commandFind \ \ "abc\" c:\test.txtFind the line containing the ABC string in the c:\test.txt file If not found, the errorlevel return code is set to 1Find /i, "ABC", c:\test.txtFind rows containing ABC, ignore case"Find /c \" "abc\" c:\test.txtShows the number of rows containing ABC20 more (external command)Screen by screen displayMore c:\test.txt # by screen display c:\test.txt file content 21 treeDisplay directory structureTree d:\ # display D disk file directory structure22 &Execute multiple commands in sequence, regardless of whether the command succeeds23 & &Execute multiple commands in sequence, and do not execute the following command when the command that executes the error is encounteredFind "ok\" c:\test.txt & & echoIf the word "ok\" is found, it is shown "success" and cannot be found if it is not found24 ||Execute multiple commands in sequence, and do not execute the following command when the correct command is encounteredFind "ok\" c:\test.txt echo || unsuccessfulIf the word "ok\" is not found, it is shown "unsuccessful \" and is not displayed when it is found25 |Pipe commandDir /s/a find /c. * | \ ".Exe\"The pipe command indicates that the dir command is executed first, and the subsequent find command is executed for the output of the commandThe command line results: output the number of.Exe files in the current folder and all subfoldersType c:\test.txt|moreThis is the same effect as the more c:\test.txt26 > andOutput redirection command> purge the original contents of the file before writing themAppend content to the end of the file without removing the original contentThe main contents of the original display on the screen is output to the specified fileIf the specified file does not exist, the file is automatically generatedType c:\test.txt >prnThe file content is not displayed on the screen, and the output is turned to the printerEcho Hello world>conThe Hello world is displayed on the screen, and virtually all outputs are default >conCopy c:\test.txt f: >nulCopy files and do not display "copy success \" prompt information, but if the f disk does not exist, it will still display error messagesCopy, c:\test.txt, f:, >nul, 2>nulDo not display the prompt information for the successful copy of the file, and the error message is not displayed if the f disk does not existEcho ^^W ^W>c:\test.txt ^>The generated file content is ^W > W"^" and "> are control commands. To output them to a file, you must add a" ^ "sign in front< 27Get input information from the file, not from the screenGenerally used for date, time, label, etc., need to wait for the input command@echo offEcho 2005-05-01>temp.txtDate del temp.txtThis way you can wait for the input to change the current date directly28%0%1%2%3%4%5%6%7%8%9%The command line passes the parameters to the batch%0 batch file itself%1 first parameter%9 ninth parametersAll parameters% from the first parameterThe substitution of batch parameter (%n) has been enhanced. You can use the following syntax:%~1 - delete quotation marks [[]) to expand%1%~f1 - extends%1 to a fully qualified path name%~d1 - extends%1 to a drive letter only%~p1 - extends%1 to only one path%~n1 - extends%1 to only one file name%~x1 - extends%1 to only one file extension%~s1 - extended path refers to a short name%~a1 - extend%1 to file attributes%~t1 - extend the%1 to the date / time of the file%~z1 - extends%1 to the size of the file%~$PATH: 1 - finds the column in the directory of the PATH environment variable, and%1Expand to the first fully qualified name to find. If the environmentThe variable name is not defined, or the file has not been found. This key combination willExtended to empty stringCan be combined to obtain multiple results with revision:%~dp1 - extends%1 to drive letters and paths only%~nx1 - extends%1 to file names and extensions only%~dp$PATH:1 - find%1 in the directory that is listed in the PATHenvironment variable,And extend to the drive letter and path to find the first file.%~ftza1 - extend%1 to similar output lines like DIR.You can see the meaning of each parameter by referring to call/ or for/Echo, load \%%1\, \%%2\, >c:\test.txtThe generated file contents are load \%1\ '\%2\'"In a batch file, the command line arguments are output to the file in this format29 IfJudgement commandIf "%1\" /a\ "echo" ==\ the first parameter is the /aIf /i \ \%1\ 'equ \ /a\' echo, the first parameter is /a/i said the case insensitive, and equ = = is the same, other operators see if/?If exist c:\test.bat echo exists c:\test.bat fileIf, not, exist, c:\windowsEcho does not exist in the c:\windows folder)If, exist, c:\test.batEcho exists c:\test.bat(else)Echo does not exist, c:\test.bat)30 SETLOCAL and endlocalSet the command extension and postpone the extension of the environment variable"SETLOCAL ENABLEEXTENSIONS # "command extensions enable \ \"SETLOCAL DISABLEEXTENSIONS # disable command extensions \ \ ""SETLOCAL enabledelayedexpansion #启用”延缓环境变量扩充\”SETLOCAL disabledelayedexpansion #停用”延缓环境变量扩充\”ENDLOCAL #恢复到使用SETLOCAL语句以前的状态“命令扩展名”默认为启用“延缓环境变量扩充”默认为停用批处理结束系统会自动恢复默认值可以修改注册表以禁用”命令扩展名\”,详见cmd /?。
批处理命令大全

的字符串的。 %i专门在for语句中得到说明,%j和%k是通过tokens=选项 专门得到说明的。您可以通过tokens=一行指定最多26个
符号,只要不试图说明一个高于字母'z'或'Z'的变数。请记 住,FOR变量名分大小写,是通用的;而且,同时不能有 52个以上都在使用中。 您还
可以在相邻字符串上使用FOR/F分析逻辑;方法是,用单 引号将括号之间的filenameset括起来。这样,该字符串会 被当作一个檔中的一个单一
程序执行完毕跳至标题exit处退出 gotoexit :exit Rem这里是程序的出口 2、IFstring1==string2c
ommand 检测当前变量的值做出判断 ECHOOFF IF%1==2gotono Echo变数相等! Gotoexit :no
echo变数不相等 gotoexit :exit 大家可以这样看效果C:>test.bat数字 3、IF[NOT]EXISTfi
部分:特殊的符号与批处理 在命令行下有些符号是不允许使用的但有些符号却有着特殊的意 义。 1、符号(@) @在批处理中的意思是关闭当前行
的回显。我们从上面知道用命令echooff可以关掉整个批 处理的命令回显但却不能不显示echooff这个命令。现在 我们在这个命令前加上@这样e
chooff这一命令就被@关闭了回显从而达到所有命令均不回 显得要求 2、符号(>) >的意思是传递并覆盖。他所起的作用是将运行后的回显结
D如果集中包含通配符,则指定与目录名匹配,而不与文 件名匹配。 /F从指定的文件中读取数据作为变量 eol=c-指一个行注释字符的结尾(就
一个) skip=n-指在檔开始时忽略的行数。 delims=xxx-指分隔符集。这个替换了空格和跳格键的默认分隔符 集。 tokens
批处理命令详解

批处理命令详解————————————————————————————————作者:————————————————————————————————日期:批处理命令详解1.Echo 命令打开回显或关闭请求回显功能,或显示消息。
如果没有任何参数,echo命令将显示当前回显设置。
语法ﻫecho [{on|off}] [message]Sample:echo off / echo hello worldﻫ在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。
ﻫﻫ2.@命令表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。
Sample:@echo offﻫ@echo Now initializing the program,please wait a minite... @format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。
)ﻫ3.Goto 命令ﻫ指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。
ﻫ语法:goto label (label是参数,指定所要转向的批处理程序中的行。
)ﻫSample:ﻫif {%1}=={} goto noparmsif {%2}=={} gotonoparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。
)@Rem check parameters if null show usageﻫ:noparmsﻫecho Usage: monitor.bat Ser verIP PortNumbergotoendﻫ标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。
mrt.exe是什么程序

mrt.exe是什么程序
有没有网友在上网中发现电脑非常卡,在一旁的安全软件球会显示出一个mrt.exe软件,占用CPU特别高,那么这是怎么回事呢?今天店铺就为大家带来了mrt.exe是什么软件的介绍,希望能够帮到大家。
mrt.exe是一款安全监测程序
1、一些优化软件可以检测到mrt.exe文件占用CPU很高!
2、如果没有优化软件,按三键(Ctrl+Alt+Del)调出【Windows 任务管理器】→进程→也会看到mrt.exe文件占用cpu很高。
3、通常情况下,这是在安全软件打了这个补丁之后,会自动运行一次进行全盘扫描的。
但是这个补丁比较神秘,有些系统在控制面板的添加或删除程序中是不会显示的!
4、只要使用mrt.exe作为关键词搜索一下,就会有该程序了,通常是保存在这个路径之下:C:WindowsSystem32
5、如果双击,可以打开并需要安装。
点击接受协议(勾选中),否则下一步按钮不可用(灰色)
6、点开列表,就能看到这个月(最新)恶意程序的清单。
7、全盘扫描的时候,它会逐一比对,如有恶意程序,自动删除。
8、然后,点选扫描方式→下一步
9、扫描的时候(时间稍长),尽量不要开启其它的程序,它比较强势!否则会出错。
10、一般而言,这种扫描操作都会无所事事,究其原因是:操作系统内只要安装了安全软件(该程序不能替代安全软件),还没等到恶意软件兴风作浪,早就被它剔除了!而真正的病毒、木马它倒不会识别出来……
11、怎么样?说的没错吧,从来没有见它抓到鬼!
mrt.exe是。
批处理命令大全(合集命令)

1 echo 和回显控制命令#关闭单行回显echo off #从下一行开始关闭回显echo off #从本行开始关闭回显。
一般批处理第一行都是这个echo on #从下一行开始打开回显echo #显示当前是echo off 状态还是echo on 状态echo. #输出一个"回车换行",一般就是指空白行echo hello world #输出hello world"关闭回显"是指运行批处理文件时,不显示文件里的每条命令,只显示运行结果批处理开始和完毕时,系统都会自动打开回显2 errorlevel程序返回码echo %errorlevel%每个命令运行完毕,可以用这个命令行格式查看返回码用于判断刚刚的命令是否执行成功默认值为0,一般命令执行出错会设errorlevel 为13 dir显示目录中的文件和子目录列表dir #显示当前目录中的文件和子目录dir /a #显示当前目录中的文件和子目录,包括隐藏文件和系统文件dir c: /a:d #显示C 盘当前目录中的目录dir c:\ /a:-d #显示C 盘根目录中的文件dir d:\mp3 /b/p #逐屏显示d:\mp3 目录里的文件,只显示文件名,不显示时间和大小dir *.exe /s其中* 是通配符,代表所有的文件名,还一个通配符? 代表一个任意字母或汉字如c*.* 代表以 c 开头的所有文件?.exe 代表所有文件名是一个字母的.exe文件如果指定的目录或文件不存在,将返回errorlevel 为1每个文件夹的dir 输出都会有2个子目录. 和... 代表当前目录.. 代表当前目录的上级目录dir . #显示当前目录中的文件和子目录dir .. #显示当前目录的上级目录中的文件和子目录其它参数可参考dir /?4 cd更改当前目录cd mp3 #进入当前目录中的mp3 目录cd .. #进入当前目录中的上级目录cd\ #进入根目录cd #显示当前目录cd /d d:\mp3 #可以同时更改盘符和目录cd\"Documents and Settings"\All users文件名带空格,可以不加引号建议加上引号,因为有的时候不加引号会运行出错,如登录脚本如果更改到的目录不存在,如此出错返回errorlevel=15 md创建目录md abc #在当前目录里建立子目录abcmd d:\a\b\c #如果d:\a 不存在,将会自动创建6 rd删除目录rd abc #删除当前目录里的abc 子目录,要求为空目录rd /s/q d:\temp #删除d:\temp 文件夹与其子文件夹和文件,不需要按Y 确认7 del删除文件del d:\test.txt #删除指定文件,不能是隐藏、系统、只读文件del *.*删除当前目录里的所有文件,不包括隐藏、系统、只读文件,要求按Y 确认del /q/a/f d:\temp\*.*删除d:\temp 文件夹里面的所有文件,包括隐藏、只读、系统文件,不包括子目录del /q/a/f/s d:\temp\*.*删除d:\temp 与子文件夹里面的所有文件,包括隐藏、只读、系统文件,不包括子目录8 ren文件重命名ren d:\temp tmp #支持对文件夹的重命名9 cls清屏10 type显示文件容type c:\boot.ini #显示指定文件的容,程序文件一般会显示乱码type *.txt #显示当前目录里所有.txt文件的容11 copy拷贝文件copy c:\test.txt d:\复制c:\test.txt 文件到d:\复制c:\test.txt 文件到d:\ ,并重命名为test.bakcopy c:\*.*复制c:\ 所有文件到当前目录,不包括隐藏文件和系统文件不指定目标路径,如此默认目标路径为当前目录con代表屏幕,prn代表打印机,nul代表空设备合并1.txt 和 2.txt 的容,保存为3.txt 文件如果不指定3.txt ,如此保存到1.txtcopy test.txt +复制文件到自己,实际上是修改了文件日期12 title设置cmd窗口的标题title 新标题#可以看到cmd窗口的标题栏变了13 ver显示系统版本14 label 和vol设置卷标vol #显示卷标label #显示卷标,同时提示输入新卷标label c:system #设置C盘的卷标为system15 pause暂停命令运行该命令时,将显示下面的消息:请按任意键继续. . .一般用于看清楚屏幕上显示的容16 rem 和::注释命令注释行不执行操作17 date 和time日期和时间date #显示当前日期,并提示输入新日期,按"回车"略过输入date/t #只显示当前日期,不提示输入新日期time #显示当前时间,并提示输入新时间,按"回车"略过输入time/t #只显示当前时间,不提示输入新时间18 goto 和:跳转命令:label #行首为:表示该行是标签行,标签行不执行操作goto label #跳转到指定的标签那一行19 find (外部命令)查找命令在c:\test.txt 文件里查找含abc 字符串的行如果找不到,将设errorlevel 返回码为1查找含abc 的行,忽略大小写显示含abc 的行的行数20 more (外部命令)逐屏显示more c:\test.txt #逐屏显示c:\test.txt 的文件容21 tree显示目录结构tree d:\ #显示D盘的文件目录结构22 &顺序执行多条命令,而不管命令是否执行成功c: & cd\ & dir /w相当于把下面3行命令写到1行去了c:cd\dir /w23 &&顺序执行多条命令,当碰到执行出错的命令后将不执行后面的命令注意如果f盘不存在,那么后面2条命令将不会执行find "ok" c:\test.txt && echo 成功如果找到了"ok"字样,就显示"成功",找不到就不显示24 ||顺序执行多条命令,当碰到执行正确的命令后将不执行后面的命令f: || e:如果有f盘就不进入e盘find "ok" c:\test.txt || echo 不成功如果找不到"ok"字样,就显示"不成功",找到了就不显示25 |管道命令前一个命令的执行结果输出到后一个命令dir *.* /s/a | find /c ".exe"管道命令表示先执行dir 命令,对其输出的结果执行后面的find 命令该命令行结果:输出当前文件夹与所有子文件夹里的.exe文件的个数type c:\test.txt|more这个和more c:\test.txt 的效果是一样的26 > 和>>输出重定向命令> 去除文件中原有的容后再写入>> 追加容到文件末尾,而不会去除原有的容主要将本来显示在屏幕上的容输出到指定文件中指定文件如果不存在,如此自动生成该文件生成c:\test.txt文件,容为hello world这个格式在批处理文件里用得很多,可以生成.reg .bat .vbs 等临时文件type c:\test.txt >prn屏幕上不显示文件容,转向输出到打印机echo hello world>con在屏幕上显示hello world,实际上所有输出都是默认>con 的copy c:\test.txt f: >nul拷贝文件,并且不显示"文件复制成功"的提示信息,但如果f盘不存在,还是会显示出错信息copy c:\test.txt f: >nul 2>nul不显示"文件复制成功"的提示信息,并且f盘不存在的话,也不显示错误提示信息生成的文件容为^W > W^ 和> 是控制命令,要把它们输出到文件,必须在前面加个^ 符号27 <从文件中获得输入信息,而不是从屏幕上一般用于date time label 等需要等待输入的命令echo off这样就可以不等待输入直接修改当前日期28 %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %*命令行传递给批处理的参数%0 批处理文件本身%1 第一个参数%9 第九个参数%* 从第一个参数开始的所有参数在C盘根目录新建test.bat,容如下:echo offecho %0echo %1echo %2echo %*运行cmd,输入c:\test.bat "/a" /b /c /d可以看出每个参数的含意修改test.bat容如下echo offecho %1echo %~1echo %0echo %~f0echo %~d0echo %~p0echo %~n0echo %~x0echo %~s0echo %~a0echo %~t0echo %~z0再运行cmd,输入c:\test.bat "/a" /b /c /d可以参照call/? 或for/? 看出每个参数的含意注意这里可以对文件进展日期比拟和大小比拟生成的文件容为load "%1" "%2"批处理文件里,用这个格式把命令行参数输出到文件29 if判断命令if "%1"=="/a" echo 第一个参数是/aif /i "%1" equ "/a" echo 第一个参数是/a/i 表示不区分大小写,equ 和== 是一样的,其它运算符参见if/? if exist c:\test.bat echo 存在c:\test.bat文件if not exist c:\windows (echo 不存在c:\windows文件夹rem 有多条命令可用小括号括起来,称为"复合语句"rem 行前的空格是为了看起来条理清楚)if exist c:\test.bat () else (rem else表示"否如此",判断结果为假时执行其后的命令)30 setlocal 和endlocal设置"命令扩展名"和"延缓环境变量扩大"SETLOCAL ENABLEEXTENSIONS #启用"命令扩展名"SETLOCAL DISABLEEXTENSIONS #停用"命令扩展名"SETLOCAL ENABLEDELAYEDEXPANSION #启用"延缓环境变量扩大" SETLOCAL DISABLEDELAYEDEXPANSION #停用"延缓环境变量扩大" ENDLOCAL #恢复到使用SETLOCAL语句以前的状态"命令扩展名"默认为启用"延缓环境变量扩大"默认为停用批处理完毕系统会自动恢复默认值可以修改注册表以禁用"命令扩展名",详见cmd /? 。
批处理的见命令REM,ECHO,GOTO,CALL,PAUSE,IF
批处理的见命令REM,ECHO,GOTO,CALL,PAUSE,IF批处理的常见命令REMECHOGOTOCALLPAUSEIF还有(FOR,SETLOCAL,SHIFT)基于这几个命令比较难,不适合放在一日一动画里批处理定义:顾名思义,批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT。
这些命令统称批处理命令。
介绍命令1、REMREM是个注释命令,一般用来给程序加上注解,该命令后的内容在程序执行时,将不会被显示和执行。
例:REM 这个命令就是注释这一句将不会被执行2、ECHOECHO是一个回显命令,主要参数有OFF和ON。
一般用ECHO MESSAGE来显示一个特定的消息。
例:Echo offRem 以上代表关闭回显(就是不显示所执行的命令)Echo 这个就是消息(message)Rem 以上代表显示“这就是消息(message)”这列字符咱们来看看执行结果:3、GOTOGOTO会点编程的朋友就会知道这是跳转的意思。
在批处理中允许以“:XXX”来构建一个标号,然后用GOTO XXX 直接来执行标号后的命令。
例::lableREM 上面就是名为LABEL的标号DIR C:\DIR D:\GOTO lableREM 以上程序跳转标号LABEL处继续执行咱们来看看结果:4、CALLCALL命令可以在批处理执行过程中调用另一个批处理,当另一个批处理执行完后,再继续执行原来的批处理例:创建一个2.BAT,内容如下ECHO 这就是2的内容创建一个1.BAT,内容如下ECHO 这是1的内容CALL 2.BATECHO 1和2的内容全部显示完成。
执行1.BAT,来看看结果:5、PAUSEPAUSE,玩游戏的人都知道,暂停的意思在这里就是停止系统命令的执行并显示下面的内容。
例:PAUSE6、IFIF 条件判断语句,语法格式如下:IF [NOT] ERRORLEVEL number commandIF [NOT] string1==string2 commandIF [NOT] EXIST filename command解释下:[NOT]:将返回结果取反值,就是“如果没有”的意思ERRORLEVEL:是命令执行完成后返回的退出值Number:退出值的数字取值范围0~255,判断时值的排列顺序应该由大到小。
批处理命令大全
lenamecommand 发现特定的文件做出判断
echooff IFnotEXISTautoexec.batgoto1 echo
文件存在成功!
gotoexit :1 echo檔不存在失败! gotoexit :exit 这个批处理大家可以放在c盘和d盘分
别执行看看效果。
7、FOR FOR这个命令比较特殊是一个循环执行命令的命令,同时 FOR的循环里面还可以套用FOR在进行循环。这篇我们介
C::>SHIFT.BAT12345678
91011 123456789 2345678910
34567891011 以上就是基于WIN2000下的9个批处理命令。 第二
部分:特殊的符号与批处理
在命令行下有些符号是不允许使用的但有些符号却有着特殊的意 义。 1、符号(@) @在批处理中的意思是关闭当前行
3000:3530,571202.108.txt 5个文件18,630,070字节 0个目录1,191,542,784可用字节 >>将
命令执行的结果覆加在了原始的檔内容后面。 4、符号(|) |是一个管道传输命令意思是将上一命令执行的结果传递给下一命 令去处理。例:
行的时候有作用。当批处理运行完成后环境变量PATH将 会还原。
9、SHIFT SHIFT命令可以让在命令上的的命令使用超过10个(%0~
%9)以上的可替代参数例: ECHOOFF ECHO%1%2%3%4%5%6%7%8%9 SHIFT ECHO%1%2%3%4%5%
6%7%8%9 SHIFT ECHO%1%2%3%4%5%6%7%8%9 执行结果如下:
的回显。我们从上面知道用命令echooff可以关掉整个批 处理的命令回显但却不能不显示echooff这个命令。现在 我们在这个命令前加上@这样e
批处理命令大全及使用方法
批处理命令大全.Echo 命令打开回显或关闭请求回显功能,或显示消息。
如果没有任何参数,echo 命令将显示当前回显设置。
语法echo [{on|off}] [message]Sample:echo off / echo hello world在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。
2.@ 命令表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。
Sample:@echo off@echo Now initializing the program,please wait a minite...@format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。
)3.Goto 命令指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。
语法:goto label (label是参数,指定所要转向的批处理程序中的行。
)Sample:if {%1}=={} goto noparmsif {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。
)@Rem check parameters if null show usage:noparmsecho Usage: monitor.bat ServerIP PortNumbergoto end标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。
最好有一些说明这样你别人看起来才会理解你的意图啊。
4.Rem 命令注释命令,在C语言中相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。
批处理命令详解
批处理命令详解第一部分:批处理的专用命令批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT。
这些命令统称批处理命令,下面我就来给大家介绍一下批处理的命令。
1、REMREM 是个注释命令一般是用来给程序加上注解的,该命令后的内容在程序执行的时候将不会被显示和执行。
例:REM 你现在看到的就是注解,这一句将不会被执行。
在以后的例子中解释的内容都REM 会放在REM后面。
请大家注意。
2、ECHOECHO 是一个回显命令主要参数有OFF和 ON,一般用ECHO message来显示一个特定的消息。
例:Echo offRem 以上代表关闭回显即不显示所执行的命令Echo 这个就是消息。
Rem 以上代表显示"这就是消息"这列字符执行结果:C:\>ECHO.BAT这个就是消息。
3、GOTOGOTO 即为跳转的意思。
在批处理中允许以":XXX"来构建一个标号然后用GOTO :标号直接来执行标号后的命令。
例:LABELREM 上面就是名为LABEL的标号。
DIR C:\DIR D:\GOTO LABELREM 以上程序跳转标号LABEL处继续执行。
4、CALL黑蚂蚁安全网()CALL 命令可以在批处理执行过程中调用另一个批处理,当另一个批处理执行完后再继续执行原来的批处理。
例:批处理2.BAT内容如下:ECHO 这就是2的内容批处理1.BAT内容如下:ECHO 这是1的内容CALL 2.BATECHO 1和2的内容全部显示完成执行结果如下:C:\>1.BAT这是1的内容这就是2的内容1和2的内容全部显示完成5、PAUSEPAUSE 停止系统命令的执行并显示下面的内容。
例:C:\> PAUSE请按任意键继续 . . .6、 IFIF 条件判断语句,语法格式如下:IF [NOT] ERRORLEVEL number commandIF [NOT] string1==string2 commandIF [NOT] EXIST filename command[NOT] 将返回的结果取反值即"如果没有"的意思。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
利用MRT进行MODIS产品的批处理步骤:
1.首先利用MRT生成参数文件.prm(parameters file)
生成参数文件主要分为三个部分,一是选择要合成的文件,选择需要的波段,二是确定空间范围;三是确定投影信息,空间分辨。
确定好这三个部分,把参数文件保存起来。
2.MRT批处理命令
第一条命令:
dir /b/s D:\modistools\bin\NDVI\*A2013001*.hdf >> D:\modistools\bin\NDVI\list.txt
该命令的意思是找到文件存储路径下所有的*A2013001*.hdf文件,生成这些文件的list.txt。
比如以东北地区,MOD123 产品为例,2013年001天的文件共有12个。
第二条命令:
D:
MRTMOSAIC -i D:\modistools\bin\NDVI\list.txt -o D:\NDVI\MOD123.hdf -s "1 0 0 0 0 0 0 0 0 0 0 "
该命令首先是利用list.txt 文件了的文件进行合成,-o 是输出的意思,-o D:\NDVI\MOD123.hdf 是输出的临时文件,名字随便起,这个临时文件里存储的是想要的数据集。
-s "1 0 0 0 0 0 0 0 0 0 0 " 代表输出的是第一数据集,用1和0 进行选择,需要的数据集设为1,不需要的设为0,以MOD123为例,一个MOD123.hdf 里共有11个数据集(data fields),如果只需要NDVI,则是"1 0 0 0 0 0 0 0 0 0 0 "
根据自己选取的数据集,MOD123.hdf 临时文件就存储成如下结构:
第三条命令:
RESAMPLE -p D:\modistools\bin\NDVI.prm -i D:\NDVI\MOD123.hdf
-o D:\modistools\bin\NDVI\NDVI.tif
该命令是重采样,根据第一步保存的参数文件和临时文件,进行重采样,然后输出,需要注意的是,输出的文件名是又两部分组成自己起的名字+临时文件数据集的名字,如在这里自己起的名字是NDVI.tif,临时文件数据集的名字是 1 km monthly NDVI, 那么存储到路径下的文件的名字是NDVI. 1_km monthly_NDVI.tif,临时文件数据集名字里的空格在输出时保存为下划线。
第四条命令:
以上三条命令已经是完成了MRT的批处理,如果想根据自己的要求修改文件名,可以使用一下命令:copy D:\modistools\bin\NDVI\NDVI.1_km_monthly_NDVI.tif
D:\modistools\bin\NDVI\NDVI001.tif
该命令的功能就是将NDVI.1_km_monthly_NDVI.tif 改为NDVI001.tif
以上就是MRT批处理命令的解释。
下面是根据自己要求写的MRT处理MOD123 的代码:
dir /b/s D:\modistools\bin\NDVI\*A2013001*.hdf >> D:\modistools\bin\NDVI\list.txt
D:
MRTMOSAIC -i D:\modistools\bin\NDVI\list.txt -o D:\NDVI\MOD123.hdf -s "1 0 0 0 0 0 0 0 0 0 0 " RESAMPLE -p D:\modistools\bin\NDVI.prm -i D:\NDVI\MOD123.hdf -o D:\modistools\bin\NDVI\NDVI.tif copy D:\modistools\bin\NDVI\NDVI.1_km_monthly_NDVI.tif D:\modistools\bin\NDVI\NDVI001.tif
del D:\modistools\bin\NDVI\list.txt
dir /b/s D:\modistools\bin\NDVI\*A2013032*.hdf >> D:\modistools\bin\NDVI\list.txt
D:
MRTMOSAIC -i D:\modistools\bin\NDVI\list.txt -o D:\NDVI\MOD123.hdf -s "1 0 0 0 0 0 0 0 0 0 0 " RESAMPLE -p D:\modistools\bin\NDVI.prm -i D:\NDVI\MOD123.hdf -o D:\modistools\bin\NDVI\NDVI.tif copy D:\modistools\bin\NDVI\NDVI.1_km_monthly_NDVI.tif D:\modistools\bin\NDVI\NDVI032.tif
del D:\modistools\bin\NDVI\list.txt
dir /b/s D:\modistools\bin\NDVI\*A2013060*.hdf >> D:\modistools\bin\NDVI\list.txt
D:
MRTMOSAIC -i D:\modistools\bin\NDVI\list.txt -o D:\NDVI\MOD123.hdf -s "1 0 0 0 0 0 0 0 0 0 0 " RESAMPLE -p D:\modistools\bin\NDVI.prm -i D:\NDVI\MOD123.hdf -o D:\modistools\bin\NDVI\NDVI.tif copy D:\modistools\bin\NDVI\NDVI.1_km_monthly_NDVI.tif D:\modistools\bin\NDVI\NDVI060.tif
del D:\modistools\bin\NDVI\list.txt
PS: del D:\modistools\bin\NDVI\list.txt 是删除list.txt 文件。