windows system basic operation command

                                   windows system basic operation command

windows key + R: pop operation box, enter 'cmd' into the command manager.

Inside input commands can do the following:

Operation Command Table
command Features

                                                           File / directory operations

to you

Subfolders display the current directory folder and file

dir / b

Show only sub-files in the current directory folder and file name

dir / p Pagination sub-files in the current directory folder and file
dir / ad Pagination sub-files in the current directory folder and file
dir / ad Display files in the current directory
dir c: \ test Show c: \ test directory contents
dir keys.txt  Displays the current information in the catalog of keys.txt
dir / S Recursively displays the contents of the current directory (ctrl + C key terminates the current command)
you key *  Show the information in the current directory that begin with the key files and folders
DIR / AH / OS Only displays the current directory hidden files and directories, and sorted from small to large file size
tree Displays the directory structure
tree d:\myfiles  Display d: \ myfiles directory structure
ren(rename) Rename the file or directory
ren rec.txt rec.ini  The rec.txt files in the current directory rename rec.ini
ren rec.txt rec.ini  The rec.txt files in the current directory rename rec.ini

md(make dir)

Create a directory

md movie music  Create a file called movie and music folders in the current directory
md d:\test\movie Create d: \ test \ movie directory
rd (remove dir) 

Remove directory

Example: rd movie // delete the current movie clip empty files in a directory

Example: rd / s / qd: \ test // quiet mode, delete d: \ test (in addition to the directory itself, will also delete all the files and subdirectories in the specified directory)

copy

Copy files
copy key.txt c:\doc  The current directory key.txt copied to the c: \ doc (doc if there is also a key.txt file, you will be asked whether to overwrite)
copy jobs c:\doc  The jobs file in the current directory in a folder (not recursive subdirectory) copies to the c: \ doc (doc also if there is a corresponding file, you will be asked whether to overwrite)
copy key.txt c:\doc\key_bak.txt Key.txt in the current directory will be copied to the c: \ doc, and renamed key_bak.txt (doc if there is also a key_bak.txt file, you will be asked whether to overwrite)
copy /Y key.txt c:\doc  Key.txt in the current directory will be copied to the c: \ doc (not asked directly cover write)
copy key.txt +  Copy the file to yourself, in fact, changed the file date
copy /Y key1.txt + key2.txt key.txt The content key1.txt with key2.txt under the current directory key.txt written in merger (not asked directly cover write)
copy /B art_2.7z.*    art_2.7z The art_2.7z. All Files (Sort by name in ascending order) at the beginning of the current directory merge in order to generate art_2.7z
copy/B art_2.7z.001+art_2.7z.002 art_2.7z    The merger art_2.7z.001, art_2.7z.002 files in the current directory art_2.7z

move

Moving Files
move *.png test  The png image under the current directory to the current directory test folder (if the test is also the same name exists png image, you will be asked whether to overwrite)
move /Y *.png test  The png image under the current directory to the current directory test folder (do not ask, write directly cover)
move 1.png d:\test\2.png 1.png will move in the current directory to the d drive test folder and rename it to 2.png (if the test is also the same name exists png image, you will be asked whether to overwrite)
move test d:\new  若d盘中存在new文件夹,将当前目录下的test文件夹移动到d盘new文件夹中;若不存在,将当前目录下的test文件夹移动到d盘,并重命名为new
del 删除文件   注意:目录及子目录都不会删除
del test 删除当前目录下的test文件夹中的所有非只读文件(子目录下的文件不删除;删除前会进行确认;等价于del test\*)
del /f test 

删除当前目录下的test文件夹中的所有文件(含只读文件;子目录下的文件不删除;删除前会进行确认;等价于del /f test\*)

del /f /s /q test d:\test2\*.doc  删除当前目录下的test文件夹中所有文件及d:\test2中所有doc文件(含只读文件;递归子目录下的文件;删除前不确认)

                                                               文件查看     

type

显示文本文件内容
type c:\11.txt   显示c盘中11.txt的文本内容
type conf.ini  显示当前目录下conf.ini的文本内容
type c:\11.txt | more 

分页显示c盘中11.txt的文本内容  

more 逐屏的显示文本文件内容
more conf.ini 逐屏的显示当前目录下conf.ini的文本内容   【空格:下一屏 q:退出 】

                                                               特殊符号

& 顺序执行多条命令,而不管命令是否执行成功
cd /d d:\src&work.exe /o c:\result.txt 先将当前工作目录切换到d:\src下,然后执行work.exe /o c:\result.txt命令
&& 顺序执行多条命令,当碰到执行出错的命令后将不执行后面的命令
find "ok" c:\test.txt && echo 如果找到了"ok"字样,就显示"成功",找不到就不显示
|| 顺序执行多条命令,当碰到执行正确的命令后将不执行后面的命令
find "ok" c:\test.txt || echo 如果找不到"ok"字样,就显示"不成功",找到了就不显示
,

在某些特殊的情况下可以用来代替空格使用

dir,c:\  

相当于:dir c:\

; 当命令相同的时候,可以将不同的目标用;隔离开来但执行效果不变。如执行过程中发生错误则只返回错误报告但程序还是会继续执行
dir c:\;d:\;e:\   dir c:\    dir d:\     dir e:\

                                                                输出

echo 输出一个"回车换行",空白行
echo off   后续所有命令在执行前,不打印出命令的内容
echo on   后续所有命令在执行前,打印出命令的内容
echo 123   输出123到终端屏幕
echo "Hello World!!!"   输出Hello World!!!到终端屏幕
echo test > p1.txt  输出test的字符串到当前目录中的p1.txt文件中(以覆盖的方式)

                                                             文本处理        

edit config.ini   编辑config.ini文件(会进入edit字符编辑器;按alt,可以选择对应的菜单) win7 x64下没有该命令
find 文件中搜索字符串
find /N /I "pid" 1.txt  在1.txt文件中忽略大小写查找pid字符串,并带行号显示查找后的结果
find /C "exe" 1.txt 只显示在1.txt文件中查找到exe字符串的次数
find /V "exe" 1.txt 显示未包含1.txt文件中未包含exe字符串的行s
findstr 文件中搜索字符串
findstr "hello world" 1.txt  在1.txt文件中搜索hello或world
findstr /c:"hello world" 1.txt 在1.txt文件中搜索hello world
findstr /c:"hello world" 1.txt nul

在1.txt文件中搜索hello world,并在每行结果前打印出1.txt:   注:findstr只有在2个及以上文件中搜索字符串时才会打印出每个文件的文件名,nul表示一个空文件

findstr /s /i "Hello" *.* 不区分大小写,在当前目录和所有子目录中的所有文件中的hello

                                                             网络操作                          

ping 用于检测网络是否通畅,以及网络时延情况(工作在ICMP协议上)
ping baidu.com 测试与baidu服务器的连接情况
ping chen-pc0  

测试机器名为chen-pc0的连接情况

ping 220.181.111.86   测试与ip为220.181.111.86的连接情况
ping -l 65500 -n 10 qq.com   向qq.com发送10次65500字节的ping
ping -n 6 127.0.0.1

对当前主机执行6次ping操作(花费时间为5s)

ping -t baidu.com   不断地测试baidu服务器的连接情况  
ipconfig /all  查看本地ip地址等详细信息
ipconfig /displaydns  显示本地dns缓存的内容
ipconfig /flushdns  清除本地dns缓存的内容
nslookup www.cnblogs.com  获取www.cnblogs.com的域名解析
注意: 【Ctrl+Pause Break:查看ping的统计信息;Ctrl+C:终止当前任务】
netstat 查看端口
netstat -a 查看开启了哪些端口
netstat -n 

查看端口的网络连接情况

netstat -v   查看正在进行的工作
netstat -p tcp  查看tcp协议的使用情况
tracert 182.140.167.44 

查看本机到达182.140.167.44的路由路径

route print  显示出IP路由
telnet 182.140.167.44 8000   探测182.140.167.44是否使用TCP协议监听8000端口(注意:telnet命令不支持UDP端口检测)

                                                              进程操作

tasklist

显示当前运行的进程信息(可查看PID)

taskkill  结束指定的进程
taskkill /im notepad.exe 结束名为notepad.exe的进程
taskkill /pid 1230 /pid 1241 /pid 1253 /t 结束pid为1230、1241和1253的进程以及由它们启动起来的子进程
taskkill /f /im cmd.exe /t 强制结束有名为cmd.exe的进程以及由它启动起来的子进程
user 用户
net user 

查看当前机器上的用户

net user Administrator  

查看当前机器上的Administrator用户的信息

net user Guest /active:yes 

新建一个名为dev,密码为123456的用户

net localgroup administrators dev /add  把名为dev的用户添加到管理员用户组中,使其具有管理员权限
net user dev /del  删除名为dev的用户

                                                           其他基本操作                                          

cls 清除屏幕
ver 显示当前windows系统的版本号
winver 弹框显示当前windows系统信息
vol 显示当前分区的卷标
label

显示当前分区的卷标,同时提示输入新卷标

label c:system  设置c盘的卷标为system
time 显示或设置当前时间
time /t  显示当前时间
time

设置新的当前时间(格式:hh:mm:ss),直接回车则表示放弃设置

date 显示或设置当前日期
date /t  显示当前日期
date 设置新的当前日期(格式:YYYY/MM/DD),直接回车则表示放弃设置
start 运行某程序或命令
exit 退出当前cmd窗口实例
color

设置当前cmd窗口背景色和前景色(前景色即为字体的颜色)

color 02 将背景色设为黑色,将字体设为绿色
shutdown 关闭、重启、注销、休眠计算机

 

发布了22 篇原创文章 · 获赞 0 · 访问量 746

Guess you like

Origin blog.csdn.net/cldimd/article/details/103302720