<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    懵懵燈燈的BLOG

    寒夜孤燈點(diǎn)點(diǎn)星

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      56 隨筆 :: 10 文章 :: 22 評(píng)論 :: 0 Trackbacks

    命令操作符

    1. 元字符

    在命令行中有特殊含義的一些字符,通過這些字符表示一些特殊含義,稱為元字符。它們包括:

    (1) ?????? 分隔符:包括空白、分號(hào) (;) 、逗號(hào) (,) 和雙引號(hào)

    分號(hào)和逗號(hào)分割參數(shù)和命令,如果命令和參數(shù)之間的用它們連接則默認(rèn)第一個(gè)參數(shù)為空。但是他們都會(huì)包含在 %*

    (2) ?????? 環(huán)境變量的引用符號(hào): 百分號(hào) (%)

    (3) ?????? 管道,重定向符,命令分隔符: |? &? ^ escape ? <? >

    2. 如何重定向命令輸入和輸出?

    MS-DOS 下每個(gè)進(jìn)程可以打開 10 個(gè)文件,其中有一些是默認(rèn)的,這些文件用句柄來操作:

    STDIN

    0

    鍵盤輸入

    STDOUT

    1

    輸出

    STDERR

    2

    錯(cuò)誤輸出

    UNDEFINED

    3-9

    有進(jìn)程決定的文件句柄

    文件句柄是 0~9 的整數(shù)。可以通過輸出和輸入重定向改變對(duì)文件的讀 / 寫操作。文件句柄可以看作操縱文件的指針。重定向則是對(duì)這些指針重新賦值,使其志祥所指定的文件。

    ?

    重定向操作符一共有五種:

    > ?

    輸出重定向,可以是文件名,空設(shè)備 nul, 打印機(jī) prn, 該操作符左端默認(rèn)的文件句柄是 1

    < ?

    輸入重定向, 該操作符左端默認(rèn)的文件句柄是 0

    >> ?

    追加輸出操作符,該操作符左端默認(rèn)的文件句柄是 1

    >&

    輸出重定向到另外一個(gè)文件句柄,該操作符左端默認(rèn)的文件句柄是 1

    <&

    輸入重定向到另外一個(gè)文件句柄,該操作符左端默認(rèn)的文件句柄是 0

    |

    管道操作符

    ?

    重定向命令按照在命令行中的順序進(jìn)行,例如:

    <command> >> <log-file>? 2>&1

    上述命令首先將標(biāo)準(zhǔn)輸出重定向到 <log-file> ,然后將其復(fù)制到標(biāo)準(zhǔn)錯(cuò)誤輸出。上述命令中的順序不能改變。

    ?

    另外,重定向的操作是單向的,即對(duì)讀寫操作是分開的:

    <command> 3><output-file>

    上述命令僅將對(duì)文件句柄 3 的輸出定向到 <output-file> 并不影響從文件句柄讀取原來的輸入。

    3. 如何理解管道?

    管道命令的格式如下:

    <command1> | <command2>

    一句話,該命令將 <command1> 的標(biāo)準(zhǔn)輸出重定向至管道,將 <command2> 的標(biāo)準(zhǔn)輸入重定向至管道。

    4. 如何定義復(fù)合語句?

    復(fù)合語句由一些命令操作符來連接:

    &

    <Command1> ?& <Command2>

    連接統(tǒng)一行上的兩個(gè)命令

    &&

    <Command1> ?&& <Command2>

    只有當(dāng)?shù)谝粋€(gè)命令執(zhí)行成功后才執(zhí)行第二個(gè)命令(由命令的錯(cuò)誤代碼決定)

    ||

    <Command1> ?||?<Command2>

    只有當(dāng)?shù)谝粋€(gè)命令執(zhí)行失敗后才執(zhí)行第二個(gè)命令(由命令的錯(cuò)誤代碼大于 0 決定)

    ()

    ( < Command1> ?&?<Command2>)

    用來做復(fù)合語句,可嵌套

    ; ? ,

    <Command1> ?<Parameter1>;<Parameter2>

    分割命令行參數(shù) .

    5. 命令通配符 (一些命令中某些區(qū)域)

    在有些命令的某些區(qū)域,可以使用通配符 (wildcard), 通配符有兩個(gè):

    ? 匹配任意一個(gè)字符

    * 匹配任意多個(gè)字符

    實(shí)用命令

    (in updating)

    Sort

    Find

    more

    環(huán)境變量

    1. ??? 環(huán)境變量如何初始化?

    命令解釋器某一運(yùn)行時(shí)刻的環(huán)境變量的來源和初始化依次如下建立:

    - ????????? 命令解釋器內(nèi)置變量

    - ????????? 系統(tǒng)變量(在 HKEY_LOCAL_MACHINE 下定義)系統(tǒng)管理員設(shè)定

    - ????????? 本地變量(在 HKEY_CURRENT_USER 下定義)用戶指定

    - ????????? Autoexec.bat 定義的變量

    - ????????? 登陸腳本定義的變量

    - ????????? 用戶交互命令定義的變量

    ?

    ?

    2. ? 常用環(huán)境變量

    ?

    %ALLUSERSPROFILE%

    Local

    Returns the location of the All Users Profile.

    %APPDATA%

    Local

    Returns the location where applications store data by default.

    %CD%

    Local

    Returns the current directory string.

    %CMDCMDLINE%

    Local

    Returns the exact command line used to start the current Cmd.exe.

    %CMDEXTVERSION%

    System

    Returns the version number of the current Command Processor Extensions.

    %COMPUTERNAME%

    System

    Returns the name of the computer.

    %COMSPEC%

    System

    Returns the exact path to the command shell executable.

    %DATE%

    System

    Returns the current date. Uses the same format as the date /t command.

    %ERRORLEVEL%

    System

    Returns the error code of the most recently used command. A non zero value usually indicates an error.

    %HOMEDRIVE%

    System

    Returns which local workstation drive letter is connected to the user's home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

    %HOMEPATH%

    System

    Returns the full path of the user's home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

    %HOMESHARE%

    System

    Returns the network path to the user's shared home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

    %LOGONSERVER%

    Local

    Returns the name of the domain controller that validated the current logon session.

    %NUMBER_OF_PROCESSORS%

    System

    Specifies the number of processors installed on the computer.

    %OS%

    System

    Returns the operating system name. Windows?2000 displays the operating system as Windows_NT.

    %PATH%

    System

    Specifies the search path for executable files.

    %PATHEXT%

    System

    Returns a list of the file extensions that the operating system considers to be executable.

    %PROCESSOR_ARCHITECTURE%

    System

    Returns the chip architecture of the processor. Values: x86 or IA64 ( Itanium –based).

    %PROCESSOR_IDENTFIER%

    System

    Returns a description of the processor.

    %PROCESSOR_LEVEL%

    System

    Returns the model number of the processor installed on the computer.

    %PROCESSOR_REVISION%

    System

    Returns the revision number of the processor.

    %PROMPT%

    Local

    Returns the command prompt settings for the current interpreter. Generated by Cmd.exe.

    %RANDOM%

    System

    Returns a random decimal number between 0 and 32767. Generated by Cmd.exe.

    %SYSTEMDRIVE%

    System

    Returns the drive containing the Windows server operating system root directory (that is, the system root).

    %SYSTEMROOT%

    System

    Returns the location of the Windows server operating system root directory.

    %TEMP% and %TMP%

    System and User

    Returns the default temporary directories that are used by applications available to users who are currently logged on. Some applications require TEMP and others require TMP.

    %TIME%

    System

    Returns the current time. Uses the same format as the time /t command.

    %USERDOMAIN%

    Local

    Returns the name of the domain that contains the user's account.

    %USERNAME%

    Local

    Returns the name of the user who is currently logged on.

    %USERPROFILE%

    Local

    Returns the location of the profile for the current user.

    %WINDIR%

    System

    Returns the location of the operating system directory.

    ?

    3. 如何設(shè)置包括特殊字符的環(huán)境變量?

    如果使用包含特殊字符 <, >, |, &, or ^, 的環(huán)境變量,則需要在前面加上轉(zhuǎn)義字符 ^ ,該字符即使在引號(hào)中也有效果。

    如果定義含有引號(hào)的環(huán)境變量,則引號(hào)也是變量值的一部分。

    環(huán)境變量的定義到行尾,不包括行尾空白。

    posted on 2008-04-01 13:26 懵懵燈燈 閱讀(631) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 久久久久亚洲精品无码网址| 一级毛片正片免费视频手机看 | 亚洲综合校园春色| 久久精品国产精品亚洲人人| 成年人免费观看视频网站| 九九美女网站免费| 黄页视频在线观看免费| 亚洲五月综合网色九月色| 久久亚洲精品成人777大小说| 可以免费观看一级毛片黄a | 精品亚洲成在人线AV无码| 成人午夜亚洲精品无码网站| 免费看男女下面日出水视频| 黄瓜视频高清在线看免费下载| 午夜视频免费在线观看| 成人爽a毛片免费| 久久国产精品免费一区二区三区| 老司机午夜性生免费福利 | 永久免费看mv网站入口| 男女做羞羞的事视频免费观看无遮挡| 久久国产精品2020免费m3u8| caoporm超免费公开视频| 黄页网站在线视频免费| 粉色视频在线观看www免费| 亚洲av永久无码天堂网| 亚洲av乱码一区二区三区按摩| 亚洲综合无码无在线观看| 亚洲乱码一二三四五六区| 亚洲国产精品成人综合色在线婷婷| 亚洲人成影院在线| 久久精品国产精品亚洲艾| 亚洲AV无码专区国产乱码4SE | 精品无码一级毛片免费视频观看 | 国产免费拔擦拔擦8x| 国产福利免费观看| 国产老女人精品免费视频| 亚洲Aⅴ无码一区二区二三区软件| 免费人成在线观看网站视频| 伊人久久亚洲综合影院| 国产偷窥女洗浴在线观看亚洲| 精品国产人成亚洲区|