###################################################################### 3. 内置的特殊符号(实际使用中间注意避开) ###################################################################### 微软里面内置了下列字符不能够在创建的文件名中间使用 con nul aux / / │ ││ && ^ > < *
You can use most characters as variable values, including white space. If you use the special characters <, >, │, &, or ^, you must precede them with the escape character (^) or quotation marks. If you use quotation marks, they are included as part of the value because everything following the equal sign is taken as the value. Consider the following examples: (大意: 要么你使用^作为前导字符表示.或者就只有使用双引号""了) To create the variable value new&name, type: set varname=new^&name
To create the variable value "new&name", type: set varname="new&name"
The ampersand (&), pipe (│), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments.
常用语法格式 IF [NOT] ERRORLEVEL number command para1 para2 IF [NOT] string1==string2 command para1 para2 IF [NOT] EXIST filename command para1 para2
IF EXIST filename command para1 para2 IF NOT EXIST filename command para1 para2 IF "%1"=="" goto END IF "%1"=="net" goto NET IF NOT "%2"=="net" goto OTHER IF ERRORLEVEL 1 command para1 para2 IF NOT ERRORLEVEL 1 command para1 para2 FOR /L %%i IN (start,step,end) DO command [command-parameters] %%i FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do echo %i %j %k 按照字母顺序 ijklmnopq依次取参数. eol=c - 指一个行注释字符的结尾(就一个) skip=n - 指在文件开始时忽略的行数。 delims=xxx - 指分隔符集。这个替换了空格和跳格键的默认分隔符集。
echo This is test > a.txt type a.txt echo This is test 11111 >> a.txt type a.txt echo This is test 22222 > a.txt type a.txt 第二个echo是追加 第三个echo将清空a.txt 重新创建 a.txt
netstat -n │ find "3389" 这个将要列出所有连接3389的用户的ip.
________________test.bat___________________________________________________ @echo please care echo plese care 1111 echo plese care 2222 echo plese care 3333 @echo please care @echo plese care 1111 @echo plese care 2222 @echo plese care 3333 rem 不显示注释语句,本行显示 @rem 不显示注释语句,本行不显示 @if exist %windir%/system32/find.exe (echo Find find.exe !!!) else (echo ERROR: Not find find.exe) @if exist %windir%/system32/fina.exe (echo Find fina.exe !!!) else (echo ERROR: Not find fina.exe) ___________________________________________________________________________
下面我们以具体的一个idahack程序就是ida远程溢出为例子.应该是很简单的.
___________________ida.bat_________________________________________________ @rem ver 1.0 @if NOT exist %windir%/system32/idahack.exe echo "ERROR: dont find idahack.exe" @if NOT exist %windir%/system32/nc.exe echo "ERROR: dont find nc.exe"
___________________________fpass.bat____________________________________________ @rem ver 1.0 @if NOT exist %windir%/system32/findpass.exe echo "ERROR: dont find findpass.exe" @if NOT exist %windir%/system32/pulist.exe echo "ERROR: dont find pulist.exe"