Window常用命令

1.assoc
1.1. 查看所有文件的关联
assoc
1.2. 查看.txt文件的关联
assoc .txt
1.3. 更改文件的关联
assoc .txt=exefile
1.4. 删除文件的关联
assoc .txt=

2.cd
2.1. 显示当前工作目录
cd
2.2. 更改目录
cd program
2.3. 更改不同盘符的目录
cd /d d:\
2.4. 回到上层目录
cd ..
2.5. 回到根目录
cd \

3.chkdsk
3.1. 检查D盘文件系统
chkdsk d:
3.2. 修复D盘中错误,可在重启时修复
chkdsk /f d:

4.certutil
4.1. 计算文件的md5值
certutil -hashfile mm.cfg

5.comp
5.1. 比较两个文件
comp a.txt b.txt

6.copy
6.1. 复制文件
copy a.txt a.txt.bak
6.2. 将两个文件合成一个文件
copy 1.mp3/b + 2.mp3/b 3.mp3
6.3. 新建一个文件
copy nul a.txt

7.date
7.1. 显示当前日期
date /t
7.2. 更改日期
date 2017-04-05

8.del
8.1. 删除文件
del a.txt
8.2. 删除目录及子目录中的.txt文件
del /s /f *.txt
8.3. 删除目录中的只读文件
del /a:r *
说明:如果要删除隐藏文件,需要先用attrib命令解除文件的隐藏属性后再使用del命令删除

9.dir
9.1. 显示文件详细列表
dir
9.2. 只显示文件名
dir /b
9.3. 显示指定属性的文件
dir /b /a:d 只显示目录
dir /b /a:-d 只显示文件
dir /a:h 只显示隐藏文件
dir /a:r 只显示只读文件
9.4. 按创建时间显示
dir /o:d /t:c
9.5. 查找目录中的所有.doc文件
dir /s /b *.txt

10.diskpart
10.1. 显示本机各个硬盘分区状态
diskpart
diskpart>list volume

11.findstr
11.1. 在hello.c中查找包含main字符串的行
findstr main hello.c
11.2. 查找包含hello 或 world的行
findstr “hello world” hello.c
11.3. 在hello.c中查找包含hello world字符串的行
findstr /c:”hello world” hello.c
11.4. 在当前目录及子目录中查找包括create字符串的.c文件
findstr /s create *.c

12.fsutil
12.1. 创建一个大小为1G的文件
fsutil file createnew a.txt 1073741824
12.2. 显示本机有哪些硬盘分区
fsutil fsinfo drives

13.ftype
13.1. 显示所有文件的打开文件
ftype
13.2. 查看文件的打开方式
ftype txtfile
13.3. 更改文件打开方式
ftype txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
ftype txtfile= # 打开方式变成未知程序

14.hostname
14.1. 查看主机名称
hostname

15.mkdir(md)
15.1. 创建目录
mkdir abc
15.2. 创建多层目录
mkdir a\b\c

16.more
16.1. 分屏显示文件
more a.txt

17.move
17.1. 将文件移动到temp目录
move a.txt temp
17.2. 将文件更名
move a.txt b.txt

18.rename(ren)
18.1. 更改目录中所有的.txt文件为.doc文件
rename .txt .doc
18.2. 重命名文件
rename a.txt b.txt

19.rmdir(rd)
19.1. 删除空目录
rmdir temp
19.2. 删除目录中的所有文件和子目录
rd /s /q dir

20.robocopy
20.1. 删除路径太长的目录及文件
mkdir empty # 创建空目录
robocopy /purge d:\empty d:\longlong\dir # 复制空目录

21.set
21.1. 显示所有环境变量
set
21.2. 显示以p开头的环境变量
set p
21.3. 设置环境变量
set include=c:\program\include

22.shutdown
22.1. 以倒计时方式关机
shutdown -s -t 60 # 表示60秒后关机
22.2. 中断关机
shutdown -a
22.3. 关闭并重启计算机
shutdown -r
22.4. 注销
shutdown -l

23.sort
23.1. 排序
sort a.txt

24.start
24.1. 打开网页
start www.baidu.com
24.2. 打开文件
start a.txt
24.3. 打开文件夹
start d:\

25.systeminfo
25.1. 显示系统详细信息
systeminfo

26.taskkill
26.1. 杀死进程explorer.exe
taskkill /IM explorer.exe
26.2. 杀死远程计算机上的进程
taskkill /s 192.168.90.21 /u administrator /p “explorer.exe”

27.tasklist
27.1. 查看进程列表
tasklist
27.2. 查看所有EXE文件加载的DLL文件
tasklist /m|more
27.3. 查看DLL文件被哪些程序加载
tasklist /m DLL文件名
27.4. 查询PID为1345的进程名
tasklist /fi “pid eq 1345” /fo csv

28.time
28.1. 显示当前时间
time /t
28.2. 更改时间
time 22:21:19

29.tree
29.1. 只显示目录树,不显示文件
tree
29.2. 显示目录及文件
tree /f

30.xcopy
30.1. 将c:\windows目录结构复制到d:\win目录,但不复制文件
xcopy /t /e c:\windows d:\win
30.2. 复制文件和目录
xcopy /s /e c:\dir d:\dir
30.3. 将C盘AAA文件夹复制到D盘,D盘没有AAA文件夹,故要参数/i
xcopy /i /e /y c:\aaa d:\aaa

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值