###################################################################### 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"