Skip to content

cmd命令详细表格

命令描述示例
基础命令
dir列出当前目录中的文件和子目录dir /a /s
cd切换目录cd C:\Users
cls清屏cls
echo显示消息或启用/禁用命令回显echo Hello World
exit退出命令提示符exit
help显示帮助信息help dir
ver显示 Windows 版本ver
title设置命令提示符窗口标题title My Command Prompt
chdir显示当前目录或更改目录chdir
prompt更改命令提示符prompt $P$G
文件操作命令
copy复制文件copy file1.txt file2.txt
move移动文件或重命名文件/目录move file1.txt C:\backup
del删除文件del *.tmp
type显示文件内容type readme.txt
ren重命名文件或目录ren oldname.txt newname.txt
fc比较两个文件的内容fc file1.txt file2.txt
find在文件中搜索字符串find "error" log.txt
attrib显示或更改文件属性attrib +h secret.txt
type显示文本文件内容type config.txt
more逐页显示文件内容more log.txt
sort对文件内容进行排序sort file.txt
fc比较两个文件的差异fc file1.txt file2.txt
文件夹操作命令
md创建新目录md new_folder
rd删除目录rd /s old_folder
tree以树状结构显示目录内容tree /f
xcopy复制文件和目录树xcopy C:\source D:\destination /s /e
robocopy高级文件复制robocopy C:\source D:\destination /mir /z
网络命令
ipconfig显示网络配置ipconfig /all
ping测试网络连接ping google.com
tracert跟踪路由tracert google.com
netstat显示网络连接netstat -an
arp显示和修改 ARP 缓存arp -a
nslookup域名系统查询nslookup google.com
net网络命令集合net use
系统命令
systeminfo显示系统信息systeminfo
tasklist显示正在运行的进程tasklist
taskkill终止正在运行的进程taskkill /im notepad.exe
sc服务控制sc query
chkdsk检查磁盘错误chkdsk C: /f
diskpart磁盘分区管理diskpart
format格式化磁盘format D: /fs:NTFS /q
label创建、更改或删除卷标label C: System
date显示或设置日期date
time显示或设置时间time
其他常用命令
path显示或设置搜索路径path C:\Windows\System32
set显示或设置环境变量set PATH
assoc显示或修改文件关联assoc .txt=txtfile
ftype显示或修改文件类型关联ftype txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
choice显示选择菜单choice /c YN /m "Continue?"
for循环命令for %i in (*.txt) do echo %i
if条件命令if exist file.txt echo File exists
goto跳转到标签goto :label
call调用批处理文件call script.bat
start启动程序或打开文件start notepad.exe
pause暂停批处理执行pause
timeout等待指定时间timeout /t 10
color设置命令提示符颜色color 0A
mode配置系统设备mode con: cols=80 lines=25
netsh网络配置命令netsh interface ip show config
wmicWindows 管理工具wmic cpu get name
reg注册表操作reg query HKLM\Software
schtasks计划任务管理schtasks /query
powercfg电源配置powercfg /list
driverquery显示已安装的驱动程序driverquery
msinfo32系统信息msinfo32
dxdiagDirectX 诊断工具dxdiag

基于 VitePress 的本地知识库