欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

批處理BAT加強(qiáng)函數(shù)代碼使用說明第2/3頁

 更新時(shí)間:2008年08月31日 21:47:09   作者:  
希望大家想了解BAT批處理的好好看看有所加強(qiáng),看到剛才發(fā)表的文章我也認(rèn)為BAT的重要性。這點(diǎn)大家都知道所以轉(zhuǎn)了一章好東東大家共同提高。也希望大家有好東東好思想大家來了解加強(qiáng)。

path: 表示可執(zhí)行程序的搜索路徑. 我的建議是你把你的程序copy 到
%windir%\system32\. 這個目錄里面. 一般就可以自動搜索到.
語法: copy mychenxu.exe %windir%\system32\.
使用點(diǎn)(.) 便于一目了然
對環(huán)境變量的引用使用(英文模式,半角)雙引號
%windir% 變量
%%windir%% 二次變量引用.
我們常用的還有
%temp% 臨時(shí)文件目錄
%windir% 系統(tǒng)目錄
%errorlevel% 退出代碼

輸出文件到臨時(shí)文件目錄里面.這樣便于當(dāng)前目錄整潔.

對有空格的參數(shù). 你應(yīng)該學(xué)會使用雙引號("") 來表示比如對porgram file文件夾操作
C:\>dir p*
C:\ 的目錄
2000-09-02 11:47 2,164 PDOS.DEF
1999-01-03 00:47 <DIR> Program Files
1 個文件 2,164 字節(jié)
1 個目錄 1,505,997,824 可用字節(jié)

C:\>cd pro*
C:\Program Files>

C:\>
C:\>cd "Program Files"
C:\Program Files>


######################################################################
3. 內(nèi)置的特殊符號(實(shí)際使用中間注意避開)
######################################################################
微軟里面內(nèi)置了下列字符不能夠在創(chuàng)建的文件名中間使用
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:
(大意: 要么你使用^作為前導(dǎo)字符表示.或者就只有使用雙引號""了)
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.

find "Pacific Rim" < trade.txt > nwtrade.txt
IF EXIST filename. (del filename.) ELSE echo filename. missing

> 創(chuàng)建一個文件
>> 追加到一個文件后面
@ 前綴字符.表示執(zhí)行時(shí)本行在cmd里面不顯示, 可以使用 echo off關(guān)閉顯示
^ 對特殊符號( > < &)的前導(dǎo)字符. 第一個只是顯示aaa 第二個輸出文件bbb
echo 123456 ^> aaa
echo 1231231 > bbb
() 包含命令
(echo aa & echo bb)
, 和空格一樣的缺省分隔符號.
; 注釋,表示后面為注釋
: 標(biāo)號作用
│ 管道操作
& Usage:第一條命令 & 第二條命令 [& 第三條命令...]
用這種方法可以同時(shí)執(zhí)行多條命令,而不管命令是否執(zhí)行成功
dir c:\*.exe & dir d:\*.exe & dir e:\*.exe
&& Usage:第一條命令 && 第二條命令 [&& 第三條命令...]
當(dāng)碰到執(zhí)行出錯的命令后將不執(zhí)行后面的命令,如果一直沒有出錯則一直執(zhí)行完所有命令;
││ Usage:第一條命令 ││ 第二條命令 [││ 第三條命令...]
當(dāng)碰到執(zhí)行正確的命令后將不執(zhí)行后面的命令,如果沒有出現(xiàn)正確的命令則一直執(zhí)行完所有命令;

常用語法格式
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依次取參數(shù).
eol=c - 指一個行注釋字符的結(jié)尾(就一個)
skip=n - 指在文件開始時(shí)忽略的行數(shù)。
delims=xxx - 指分隔符集。這個替換了空格和跳格鍵的默認(rèn)分隔符集。

相關(guān)文章

最新評論