Windows终端常用指令
发表于|更新于|分类3 (教程)
1.start
start <file> |
2.assoc
2.1查询
assoc .c #查询类型关联 |
2.2 更改
assoc .c=cfile #更改类型关联 |
3.ftype
3.1查询
ftype cfile #查询关联执行路径 |
3.2更改
ftype cfile="F:/Vscode/Code.exe" %1 #更改关联路径 |
4.echo
echo > hello.c # 创建hello.c文件 |
5.del
del hello.c#删除hello.c文件 |
6.chcp
6.1更改编码环境为GBK
chcp 936 |
6.2更改编码环境为UTF-8
chcp 65001 |
7.shutdown
7.1定时关机
shutdown /s /t 3600 #1小时后自动关机 |
7.2重启计算机
shutdown /r |
7.3注销计算机
shutdown /l |
7.4休眠计算机
shutdown /h /f #强制正在运行的应用程序关闭 |
8.powercfg.exe
powercfg.exe /hibernate on #启用睡眠 |
9.sfc
sfc /scannow #系统文件检查器扫描 |
10.cd
cd <Path> #进入路径 |
11.rd
rd /s /q test #安静模式删除test目录以及所有子目录和文件 |
12.move
12.1移动文件
move *.png test #将当前目录下的png图片移动到当前目录下test文件夹中(询问覆盖) |
12.2移动目录
move test d:\new #若d盘中存在new文件夹,将当前目录下的test文件夹移动到d盘new文件夹中;若不存在,将当前目录下的test文件夹移动到d盘,并重命名为new |
13.dir
dir *.c #显示当前文件夹下所有c文件 |
14.replace
replace F:/Code/hello.c D:/Code #将"D:/Code"路径下的中的helo.c文件替换为"F:/Code/hello.c" |
15.type
type hello.c #查看hello.c文件内容 |
16.set/setx
16.1查看
set PATH#查看环境变量 |
16.2覆盖
set PATH"C:\Program Files\" #将PATH变量覆盖为C:\Program Files\ |
16.3增加(不推荐)
set PATH=%PATH%;C:\Program Files\ #当前窗口有效 |
进阶指令
1.查询当前文件夹
for /r test %i in (*.c) do @echo %i #查询当前目录test文件夹中的所有.c文件 |
2.指定文件夹查询文件
where /R test a.txt |
文章作者: Jamth
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Jamth!