懵懵燈燈的BLOG

          寒夜孤燈點點星

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            56 隨筆 :: 10 文章 :: 22 評論 :: 0 Trackbacks

          輸入輸出部分

          1.?????? 怎樣讀取用戶從終端 / 某文件輸入的一行字符串?

          SET /p <variable>=[<prompt-string>]

          ?

          SET /p <variable>=[<prompt-string>] < <file-full-path-name>

          2.?????? 怎樣輸出信息:

          ECHO <info>

          3.?????? 怎樣避免腳本文件中的命令回顯 ? (命令執行時出現命令提示符和本次命令字符串,但不包括命令的執行結果)

          ECHO off

          ... <command-lines> ...

          ECHO on

          4.?????? 怎樣避免單條語句的命令回顯 ?

          REM 特別是關閉回顯的 Echo 命令

          @ECHO off

          5.?????? 怎樣得知當前回顯打開 / 關閉情況?

          ECHO

          6.?????? 怎樣寫注釋?

          REM <comment>

          7.?????? 怎樣避免命令執行結果輸出?

          將命令執行結果重定向到 nul 文件

          <command> > nul

          8.?????? 怎樣暫停執行并提示按任意鍵繼續 ?

          PAUSE

          提示按任意鍵繼續

          Press any key to continue . . .

          在程序 pause 后可以用 <Ctrl+C> 結束腳本下面的執行,系統提示:

          Terminate batch job (Y/N)?

          9.? ?? 如何定制命令提示符?

          我們經常會在腳本文件中起一個子 Shell, 定制它的一些環境變量,然后完成一些特殊的工作,這個時候會定制命令提示符,反映一些環境信息。因此在運行一個子 Shell 之前需要將 PROMPT 環境變量設置為所需格式

          PROMPT [<text>]

          ????????????? 其中 <text> 的格式如下:

          恢復系統默認的提示符格式 $P$G, 清除環境變量 PROMPT 定義

          $A

          & (Ampersand)

          $B

          | (Pipe)

          $C

          ( (left parenthesis)

          $D

          Current data

          $E

          Escape code (ASCII code 27)

          $F

          )? (right parenthesis)

          $G

          >?? (greater than sign)

          $H

          Backspace? (erase previous character)

          $L

          <? (less than sign)

          $N

          Current drive

          $P

          Current drive and path

          $Q

          =

          $S

          (space)

          $T

          Current time

          $V

          Windows XP version number

          $_

          Carriage return and line feed

          $$

          $ (dollar sign)

          $N

          Current

          $P

          Current

          $Q

          =

          $S

          (space)

          $T

          Current time

          $+

          The number of + to indicate the number of directory in the PUSHD stack (Extension required)

          $M

          Display the remote name associated with the current drive letter or an empty string if current drive is not a network drive. (Extension required)

          ?????????????

          ?????????????

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?

          ?














          SET PROMPT= [<text>]

          上述命令也能起到同樣的效果

          10. 如何清除屏幕?

          CLS








          ?

          posted on 2008-03-21 00:54 懵懵燈燈 閱讀(754) 評論(0)  編輯  收藏 所屬分類: OS_Windows

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 德兴市| 洪江市| 永寿县| 右玉县| 上思县| 日喀则市| 射洪县| 隆子县| 岳普湖县| 乌兰浩特市| 松滋市| 珠海市| 鹤壁市| 明水县| 凉城县| 琼海市| 扎赉特旗| 文安县| 竹溪县| 屏边| 临沭县| 弥勒县| 朝阳县| 沅陵县| 青龙| 赤壁市| 榆中县| 黄陵县| 扎赉特旗| 宁陵县| 鹤壁市| 长寿区| 蕉岭县| 巴南区| 东兴市| 红原县| 定陶县| 密山市| 务川| 德阳市| 金门县|