很多的系統管理員可能認為命令行是程序員編程用的,這是不對的,其實命令行是另一種用來管理計算機的接口。
1 命令行窗口
Windows NT/Windows 2000以后的操作系統為用戶提供了兩種命令行窗口:cmd.exe和command.com,CMD.EXE是Windows 窗口命令行接口,因此它可以通過窗口右上角的X來關閉,它不是一個dos窗口,而COMMAND.COM是一個16位的DOS應用程序,它用于支持老的dos應用程序,它必須通過命令行輸入exit才可以退出,它一般運行于NTVDM中。但就用戶來說,這兩個命令有驚人的相似之處,如果用戶運行command.exe,用戶會在任務管理器中看到一個進程ntvdm.exe在運行,如果運行cmd.exe則進程可以看到cmd.exe,而且command.exe還支持以前的16位的現在已經不用的命令。下面分別是2種接口的打開方法和顯示結果。
在開始->運行,輸入cmd,然后enter。如下:

在開始->運行,輸入command,然后enter。如下:
2 窗口的屬性
第一種方法:
窗口中輸入命令:Cmd [{/A | /U}] [/Q] [/D] [/E: {ON | OFF}] [[/S] [{/C | /K}] string] [/V:{ON |/OFF}] [/T:FG]
參數的含義:
/C string Executes the command specified in the string and then exits the command shell.
/K string Executes the command specified in the string and does not exit the command shell.
/S Modifies the commands used as strings with the /C and /K parameters. Usually, you place quotes around command strings.The /S parameter removes the pening and closing quotes before processing the command.
/A Causes the output of internal commands to be sent to a file (this process is also called piping) in ANSI character format.
/U Causes the output of internal commands to be sent to a file (this process is also called piping) in Unicode character format.
/Q Turns off echo, which is on by default. Echo off mode is also known as quiet mode. When echo is on, each command is displayed as it is processed.
/D Disables the AutoRun command from the Registry.
/E:ON Enables command extensions if they were disabled. Command extensions are enabled by default.
/E:OFF Disables command extensions.
/F:ON Enables the completion of characters for files and directories, which help improve typing speed at the command prompt.
/F:OFF Disables the completion of characters for files and directories.
/V:ON Enables delayed environment variable expansion by using the exclamation point character (!) as the delimiter. This means that using !ThisVar! will expand the variable ThisVar at the time of execution.
/V:OFF Disables delayed environment variable expansion.
/T:FG 設定命令行窗口的前背景色
第二種方法:在命令行窗口的左上角點擊,可得到屬性設置對話框,如下:

注:可以設定執行過的命令的記錄數,然后用方向鍵查看。還有快捷鍵從F1到F9哦,怎么用自己試試看嘍。
3 命令行Shell的內部命令 命令行可以執行2種命令:內部命令和外部命令。外部命令是以.exe的形式存在的,一般存放在系統的目錄下,例如XCOPY.EXE用來拷貝整個目錄樹結構,DISKPART.EXE用來管理磁盤,IPCONFIG.EXE用來顯示和刷新計算機的IP/TCP的配置。。。
以下是比較常用的內部命令:
■ Assoc 顯示和修改文件的相關程序.
■ Call 在批處理文件中調用其他函數或批處理文件.
■ CD (ChDir) 改變目錄.
■ Color 改變前背景色.
■ Cls 清屏.
■ Copy 拷貝文件
■ Date 顯示和修改系統日期.
■ Dir 顯示目錄下文件信息.
■ Del (Erase) 刪除文件.
■ Echo 在命令行窗口種顯示文本.
■ Endlocal 退出使用本地化環境變量.
■ Exit 退出命令行窗口.
■ For 批處理文件種使用循環.
■ Ftype 顯示修改文件類型.
■ Goto 批處理文件種語句跳轉.
■ If 批處理文件種條件選擇.
■ Md (Mkdir) 創建目錄.
■ Move 移動文件.
■ Path 顯示和改變命令行窗口執行程序的搜索路徑,當無參數使用是顯示當前的系統路徑.
■ Pause 暫停批處理文件的執行.
■ PopD 使用存儲的目錄還原目錄.
■ Prompt 設置命令行窗口的顯示文本.
■ PushD 存儲當前使用的目錄.
■ Rd (Rmdir) 刪除目錄
■ Rem 在品處理文件種加注釋.
■ Set 顯示,設定或刪除環境變量. 當你無參數使用這個命令,顯示系統的環境變量
■ Setlocal 在批處理文件中開始使用本地環境變量
■ Shift 改變批處理文件中某能夠取代的參數的位置.
■ Start 打開命令行窗口.
■ Time 顯示和改變當前系統的時間.
■ Title 改變執行批處理文件時的命令行窗口的title
■ Type 顯示文本文件的內容,但是不可以修改
■ Vol 顯示分區的卷標和序列號
3 windows常用外部命令
winver---------檢查windows版本
wmimgmt.msc----打開windows管理體系結構(wmi)
wupdmgr--------windows更新程序
w腳本--------windows腳本宿主設置
write----------寫字板
winmsd---------系統信息
wiaacmgr-------掃描儀和照相機向導
winchat--------xp自帶局域網聊天
mem.exe--------顯示內存使用情況
msconfig-----------啟動
msconfig.exe---系統配置實用程序
mplayer2-------簡易widnows media player
mspaint--------畫圖板
mstsc----------遠程桌面連接
mplayer2-------媒體播放機
magnify--------放大鏡實用程序
mmc------------打開控制臺
mobsync--------同步命令
dxdiag---------檢查directx信息
drwtsn32------ 系統醫生
devmgmt.msc--- 設備管理器
dfrg.msc-------磁盤碎片整理程序
diskmgmt.msc---磁盤管理實用程序
dcomcnfg-------打開系統組件服務
ddeshare-------打開dde共享設置
dvdplay--------dvd播放器
nslookup-------ip地址偵測器
net stop messenger-----停止信使服務
net start messenger----開始信使服務
notepad--------打開記事本
nslookup-------網絡管理的工具向導
ntbackup-------系統備份和還原
narrator-------屏幕“講述人”
ntmsmgr.msc----移動存儲管理器
ntmsoprq.msc---移動存儲管理員操作請求
netstat -an----(tc)命令檢查接口
syncapp--------創建一個公文包
sysedit--------系統配置編輯器
sigverif-------文件簽名驗證程序
sndrec32-------錄音機
shrpubw--------創建共享文件夾
secpol.msc-----本地安全策略
syskey---------系統加密,一旦加密就不能解開,保護windows xp系統的雙重密碼
services.msc---本地服務設置
sndvol32-------音量控制程序
sfc.exe--------系統文件檢查器
sfc /scannow---windows文件保護(掃描錯誤并復原)
tsshutdn-------60秒倒計時關機命令
tourstart------xp簡介(安裝完成后出現的漫游xp程序)
taskmgr--------任務管理器 (2000/xp/2003)
eventvwr-------事件查看器
eudcedit-------造字程序
explorer-------打開資源管理器
packager-------對象包裝程序
perfmon.msc----計算機性能監測程序
progman--------程序管理器
regedit.exe----注冊表
rsop.msc-------組策略結果集
regedt32-------注冊表編輯器
rononce -p ----15秒關機
regsvr32 /u *.dll----停止dll文件運行
regsvr32 /u zipfldr.dll------取消zip支持
cmd.exe--------cmd命令提示符
chkdsk.exe-----chkdsk磁盤檢查
certmgr.msc----證書管理實用程序
calc-----------啟動計算器
charmap--------啟動字符映射表
cliconfg-------sql server 客戶端網絡實用程序
clipbrd--------剪貼板查看器
conf-----------啟動netmeeting
compmgmt.msc---計算機管理
cleanmgr-------垃圾整理
ciadv.msc------索引服務程序
osk------------打開屏幕鍵盤
odbcad32-------odbc數據源管理器
oobe/msoobe /a----檢查xp是否激活
lusrmgr.msc----本機用戶和組
logoff---------注銷命令
iexpress-------木馬捆綁工具,系統自帶
fsmgmt.msc-----共享文件夾管理器
utilman--------輔助工具管理器
gpedit.msc-----組策略
4 相關幫助文檔
1)可以在命令行窗口種輸入help得到幫助。
2)可以在開始->幫助和支持 中輸入:command shell,即可得到所有命令的幫助。
3)網絡資源:見前言中參考網站。
5 常用軟件安裝 在windows 2003中,可以在系統盤中找到suptools.msi 來安裝一些有用的工具,如果你是windows xp系統,你也可以到網絡上下載相關的軟件。
小技巧:如果你的命令行窗口不識別正確的命令,很有可能是你的系統變量path的原因啊,看看有沒有這3個啊,沒有的趕快加入:(ok?)
C:\Windows\System32;
C:\Windows;
C:\Windows\System32\Wbem