Windows上有用的命令行命令

这个Wiki的目标是促进使用一个命令来打开常用的应用程序,而不必经过许多鼠标点击 – 从而节省Windows机器的监视和故障排除时间。

答案条目需要指定

  • 应用名称
  • 命令
  • 截图(可选)

命令的快捷方式

  • && – 命令链接
  • %SYSTEMROOT%\ System32 \ rcimlby.exe -LaunchRA – 远程协助(Windows XP)
  • appwiz.cpl – 程序和function(以前称为“添加或删除程序”)
  • appwiz.cpl @,2 – 打开和closuresWindowsfunction(添加/删除Windows组件窗格)
  • arp – 显示和修改地址parsing协议(ARP)使用的IP到物理地址转换表
  • at – 在本地或远程安排任务,而不使用任务计划任务
  • bootsect.exe – 更新硬盘分区的主引导代码以在BOOTMGR和NTLDR之间切换
  • cacls – 更改目录,其子内容或文件的访问控制列表(ACL)权限
  • 计算器
  • chkdsk – 检查/修复磁盘表面的物理错误或坏扇区
  • 密码 – 显示或更改NTFS分区上的目录[文件]的encryption
  • cleanmgr.exe – 磁盘清理
  • clip – 将命令行工具的输出redirect到Windows剪贴板
  • cls – 清除命令行屏幕
  • cmd / k – 启用命令扩展的命令
  • 颜色 – 在控制台中设置默认的控制台前景色和背景色
  • command.com – 默认操作系统Shell
  • compmgmt.msc – 计算机pipe理
  • control.exe /名称Microsoft.NetworkAndSharingCenter – networking和共享中心
  • 控制键盘 – 键盘属性
  • 控制鼠标(或main.cpl) – 鼠标属性
  • 控制sysdm.cpl,@ 0,3 – “系统属性”对话框的“高级”选项卡
  • 控制用户密码2 – 打开传统的用户帐户对话框
  • desk.cpl – 打开显示属性
  • devmgmt.msc – 设备pipe理器
  • diskmgmt.msc – 磁盘pipe理
  • diskpart – 从命令行pipe理磁盘
  • dsa.msc – 打开活动目录用户和计算机
  • dsquery – 根据条件在目录中查找任何对象
  • dxdiag – DirectX诊断工具
  • eventvwr – Windows事件日志(事件查看器)
  • 探险家。 – select当前文件夹打开资源pipe理器。
  • explorer / e,。 – 打开资源pipe理器,文件夹树,select当前文件夹。
  • F7 – 查看命令历史logging
  • find – 在一个或多个文件中search文本string
  • findstr – 在文件中查找string
  • firewall.cpl – 打开Windows防火墙设置
  • fsmgmt.msc – 共享文件夹
  • fsutil – 执行与FAT和NTFS文件系统相关的任务
  • ftp – 从运行FTP服务器服务的计算机传输文件
  • getmac – 显示networking适配器的MAC地址(s)
  • gpedit.msc – 组策略编辑器
  • gpresult – 显示目标用户和计算机的策略的结果集(RSoP)信息
  • httpcfg.exe – HTTPconfiguration实用程序
  • iisreset – 重新启动IIS
  • InetMgr.exe – Internet信息服务(IIS)pipe理器7
  • InetMgr6.exe – Internet信息服务(IIS)pipe理器6
  • intl.cpl – 区域和语言选项
  • ipconfig – Internet协议configuration
  • lusrmgr.msc – 本地用户和组pipe理员
  • msconfig – 系统configuration
  • 记事本 – 记事本? ;)
  • mmsys.cpl – 声音/录音/播放属性
  • 模式 – configuration系统设备
  • 更多 – 一次显示一个输出屏幕
  • mrt – Microsoft Windows恶意软件删除工具
  • mstsc.exe – 远程桌面连接
  • nbstat – 使用NBT显示协议统计信息和当前的TCP / IP连接
  • ncpa.cpl – networking连接
  • netsh – 显示或修改当前正在运行的计算机的networkingconfiguration
  • netstat – networking统计
  • 净统计 – 检查计算机正常运行时间
  • 净停止 – 停止正在运行的服务。
  • networking使用 – 将计算机连接到共享资源或与共享资源断开连接,显示有关计算机连接的信息,或者使用不同的权限(文档)安装本地共享
  • odbcad32.exe – ODBC数据源pipe理员
  • pathping(path) – 收集详细数据包丢失状态的traceroute
  • perfmon – 打开可靠性和性能监视器
  • ping – 确定是否可以通过networking访问远程计算机
  • powercfg.cpl – 电源pipe理控制面板小程序
  • qfecheck – 显示已安装的修补程序应用于服务器/工作站。
  • quser – 显示有关terminal服务器上用户会话的信息
  • qwinsta – 查看断开连接的远程桌面会话
  • reg.exe – 用于Windows的控制台registry工具
  • registry编辑器
  • rasdial – 连接到VPN或拨号networking
  • robocopy – 备份/还原/可靠地复制大量的文件
  • rsop.msc – 策略的结果集(显示在当前系统/login中激活的所有组策略的组合效果)
  • runas – 以不同于用户当前login提供的权限运行特定的工具和程序
  • sc – pipe理任何你想做的服务。
  • schtasks – 使pipe理员能够创build,删除,查询,更改,运行和结束本地或远程系统上的计划任务。
  • secpol.msc – 本地安全设置
  • services.msc – 服务控制面板
  • set – 显示,设置或删除cmd.exe环境variables。
  • 在cmd.exe中 设置DIRCMD – Preset dir参数
  • 启动 – 启动一个单独的窗口来运行指定的程序或命令
  • 开始。 – 在Windows资源pipe理器中打开当前目录。
  • shutdown.exe – 关机或重新启动本地/远程机器
  • subst.exe – 将path与驱动器盘符关联,包括本地驱动器
  • systeminfo – 显示有关系统的综合信息
  • taskkill – 通过进程ID(PID)或图像名称终止任务
  • tasklist.exe – 列出本地或远程机器上的进程
  • taskmgr.exe – 任务pipe理器
  • telephon.cpl – 电话和调制解调器属性
  • timedate.cpl – date和时间
  • 标题 – 更改已打开的CMD窗口的标题
  • tracert – 跟踪路由
  • whoami / all – 显示当前用户/组/特权信息
  • wmic – Windows Management Instrumentation命令行
  • winver.exe – 查找Windows版本
  • wscui.cpl – Windows安全中心
  • wuauclt.exe – Windows Update自动更新客户端

一个鲜为人知的是

getmac 

它显示您的networking适配器的MAC地址 。

从Windows命令行窗口运行getmac的屏幕截图。

在命令提示符下键入:

 C:\> start . 

它在Windows资源pipe理器中打开当前目录。

远程桌面连接

 mstsc.exe 

打开:

一些图片演示了mstsc.exe的使用。

我用了很多的清单:

  • nbtstat – 列出NetBIOS统计和信息
  • netstat – 列出TCP / IP统计和信息
  • ipconfig – 列出系统的TCP / IPconfiguration
  • netsh – 系统的networkingconfiguration
  • sc – pipe理服务
  • 净 – 整个命令pipe理用户和组,共享,连接等
  • ping – 确保系统在networking上运行
  • tracert – 跟踪两台主机之间的跳数。 有用的是看看它们之间是否有中断。
  • nslookup – 查询DNS的信息
  • dcdiag – 检查域控制器的运行状况
  • setspn – 检查Kerberosconfiguration的SPN

服务控制面板:

 services.msc 
 shutdown.exe 

允许您closures或重新启动机器。 你甚至可以重启远程机器

 shutdown -m \\server -t 0 -r 

它甚至还带有graphics用户界面

 shutdown -i 

你可以用中止关机

 shutdown -a 

Robocopy非常有用。 它镜像目录。

这对于备份,恢复和传输大量文件非常有用。 它只传输已经改变的文件,并可以从停止的地方恢复。

它在Windows Vista和更高版本中是标准的,但Windows XP用户可以将其作为Windows Server 2003资源工具包(免费)或更高版本的一部分。

(本质上不是一个命令,而是一个到达目的地的方法。)

对于那些发现自己要开始>运行>“cmd”的人,可以减less一些步骤。

假设你想获得你的IP地址。 你通常会去开始>运行>“cmd”[回车]然后…

 ipconfig [enter] 

现在呢,去…

开始>运行>“cmd / k ipconfig”

这将运行cmd和命令“ipconfig”,并将保持窗口打开。 所以如果我想快速获得我的MAC地址(物理地址),我会做:

  cmd /k ipconfig /all 

…全部来自一行中的运行菜单。


全部由BostonMark提供

被遗忘的艺术: DOSstring操作!

 set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2% echo %mydate% 

输出将是YYYY_MM_DD

复制并粘贴到一个.bat文件,并感到惊讶! 这对于创build备份或任何时间/date系列的目录和文件特别有用。

一个例子:

 @echo off :: Yes, this looks bad, but it works, it sets the file veriable mydate to YYYY_MM_DD. set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2% echo Backing up DC1: :: start a new backup session, the /M switch is for the type of bakcup being performed, type ntbackup /? for more info start /wait ntbackup backup \\DC1\c$ /j "DC1 Backup" /f "C:\BAK\DC1\DC1_%mydate%.bkf" /M incremental echo DC1 is Done echo Backing up EXCH: start /wait ntbackup backup \\EXCH\c$ /j "EXCH Backup" /f "C:\BAK\EXCH\EXCH_%mydate%.bkf" /M incremental echo EXCH is Done echo Backing up FS1: start /wait ntbackup backup \\FS1\c$ /j "FS1 Backup" /f "C:\BAK\FS1\FS1_%mydate%.bkf" /M incremental echo FS1 is Done echo Backup was completed %date% %time% pause 
 tasklist.exe 

将列出本地或远程机器上的进程。

 tasklist.exe /S server 

它可以显示scvhost.exe进程托pipe的服务

 tasklist /SVC 

你也可以做一些过滤。 这将显示已使用超过15分钟CPU时间的远程计算机上的进程

 tasklist /S server /FI "CPUTIME gt 00:15:00" 

control userpasswords2

打开传统的“用户帐户”对话框:

在这里输入图像描述

我发现我用findstr很多东西在日志,错误文件等

一个简单的例子:在日志文件ex0905.log我们find所有其中包含2009-05-05行:

 findstr "2009-05-05" ex0905.log 

程序和function(以前称为“添加或删除程序”)

 appwiz.cpl 

打开

替代文字

有时我不得不担心terminal服务器与服务器连接的自由会话太less。

quser在terminal服务器上显示有关用户会话的信息。

 quser /SERVER:myserver 

产量

 C:\Documents and Settings\sysmanager01>quser /SERVER:serverx USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME usr_hot1 1 Disc none 30.04.2009 17:59 usr_hot 2 Disc none 30.04.2009 18:01 appsuperuser rdp-tcp#6 3 Conn . 01.01.1601 02:00 

有时甚至有可能find像appsuperuser这样纯粹的工作狂:-)

quser可执行文件从任何32位服务器粘贴到本地System32文件夹时,将会更加轻松。

我用

 qwinsta 

查看断开的远程桌面会话和

 logoff 

结束他们。

它适用于Windows 2000 , Windows XP , Windows Vista , Windows Server 2003和Windows Server 2008 (从未尝试过)。

 systeminfo 

显示大量关于系统的信息。 以下是在Vista上输出的内容:

  • 主机名
  • OS名称
  • OS版本
  • OS制造商
  • OSconfiguration
  • OS构buildtypes
  • 注册所有者
  • 注册组织
  • 产品编号
  • 原始安装date
  • 系统启动时间
  • 系统制造商
  • 系统模型
  • 系统types
  • (多个)处理器
  • BIOS版本
  • Windows目录
  • 系统目录
  • 启动装置
  • 系统区域设置
  • input区域设置
  • 时区
  • 总物理内存
  • 可用的物理内存
  • 页面文件
  • 最大尺寸
  • 页面文件
  • 可得到
  • 页面文件
  • 正在使用
  • 页面文件位置(s)
  • login服务器
  • 修补程序(S)
  • 网卡

计算机pipe理

 compmgmt.msc 

打开
在这里输入图像描述

非常有用的一个我最近才发现:

 winver.exe 

为您提供一个对话框,其中包含正在运行的Windows版本,并包含Service Pack级别和内部版本号。

仍然没有提及WMIC.exe 🙂

从远程机器,本地机器…多台机器find你想要的。

所有与操作系统相关的数据都填好了HTML页面

 WMIC OS get /all /format:htable 

看看所有可用的选项

 ALIAS - Access to the aliases available on the local system BASEBOARD - Base board (also known as a motherboard or system board) management. BIOS - Basic input/output services (BIOS) management. BOOTCONFIG - Boot configuration management. CDROM - CD-ROM management. COMPUTERSYSTEM - Computer system management. CPU - CPU management. CSPRODUCT - Computer system product information from SMBIOS. DATAFILE - DataFile Management. DCOMAPP - DCOM Application management. DESKTOP - User's Desktop management. DESKTOPMONITOR - Desktop Monitor management. DEVICEMEMORYADDRESS - Device memory addresses management. DISKDRIVE - Physical disk drive management. DISKQUOTA - Disk space usage for NTFS volumes. DMACHANNEL - Direct memory access (DMA) channel management. ENVIRONMENT - System environment settings management. FSDIR - Filesystem directory entry management. GROUP - Group account management. IDECONTROLLER - IDE Controller management. IRQ - Interrupt request line (IRQ) management. JOB - Provides access to the jobs scheduled using the schedule service. LOADORDER - Management of system services that define execution dependencies. LOGICALDISK - Local storage device management. LOGON - LOGON Sessions. MEMCACHE - Cache memory management. MEMLOGICAL - System memory management (configuration layout and availability of memory). MEMPHYSICAL - Computer system's physical memory management. NETCLIENT - Network Client management. NETLOGIN - Network login information (of a particular user) management. NETPROTOCOL - Protocols (and their network characteristics) management. NETUSE - Active network connection management. NIC - Network Interface Controller (NIC) management. NICCONFIG - Network adapter management. NTDOMAIN - NT Domain management. NTEVENT - Entries in the NT Event Log. NTEVENTLOG - NT eventlog file management. ONBOARDDEVICE - Management of common adapter devices built into the motherboard (system board). OS - Installed Operating System/s management. PAGEFILE - Virtual memory file swapping management. PAGEFILESET - Page file settings management. PARTITION - Management of partitioned areas of a physical disk. PORT - I/O port management. PORTCONNECTOR - Physical connection ports management. PRINTER - Printer device management. PRINTERCONFIG - Printer device configuration management. PRINTJOB - Print job management. PROCESS - Process management. PRODUCT - Installation package task management. QFE - Quick Fix Engineering. QUOTASETTING - Setting information for disk quotas on a volume. RECOVEROS - Information that will be gathered from memory when the operating system fails. REGISTRY - Computer system registry management. SCSICONTROLLER - SCSI Controller management. SERVER - Server information management. SERVICE - Service application management. SHARE - Shared resource management. SOFTWAREELEMENT - Management of the elements of a software product installed on a system. SOFTWAREFEATURE - Management of software product subsets of SoftwareElement. SOUNDDEV - Sound Device management. STARTUP - Management of commands that run automatically when users log onto the computer system. SYSACCOUNT - System account management. SYSDRIVER - Management of the system driver for a base service. SYSTEMENCLOSURE - Physical system enclosure management. SYSTEMSLOT - Management of physical connection points including ports, slots and peripherals, and TAPEDRIVE - Tape drive management. TEMPERATURE - Data management of a temperature sensor (electronic thermometer). TIMEZONE - Time zone data management. UPS - Uninterruptible power supply (UPS) management. USERACCOUNT - User account management. VOLTAGE - Voltage sensor (electronic voltmeter) data management. VOLUMEQUOTASETTING - Associates the disk quota setting with a specific disk volume. WMISET - WMI service operational parameters management. 

还有很多很多

 color 02 

我的朋友们,这是你唯一需要的命令。 其余的是不重要的。

链接命令,尤其是net stopstart重新启动任何服务:

 net stop w3svc && net start w3svc 

(这是一个愚蠢的例子, iisreset会这样做,但无论如何;)

 explorer . 

打开资源pipe理器并select当前文件夹。

 explorer /e, . 

打开资源pipe理器,文件夹树,select当前文件夹。

要更改已打开的CMD窗口的标题,只需使用:

title [your new title]

我有很多CMD窗口和其他程序在工作。 这个命令,结合Taskbar Shuffle(允许你拖动任务栏项目到新的命令),使我免于精神病。

Windows 7运行命令

我发现最好知道在哪里find他们,直到我经常使用它们来记住它们。

重新启动IIS

 iisreset 

我没有看到名单上的任务技能。

TASKKILL [/ S系统[/ U用户名[/ P [密码]]]] {[/ FIfilter] [/ PID processid | / IM imagename]} [/ F] [/ T]

参数列表:/ S system指定要连接的远程系统。

 /U [domain\]user Specifies the user context under which the command should execute. /P [password] Specifies the password for the given user context. Prompts for input if omitted. /F Specifies to forcefully terminate process(es). /FI filter Displays a set of tasks that match a given criteria specified by the filter. /PID process id Specifies the PID of the process that has to be terminated. /IM image name Specifies the image name of the process that has to be terminated. Wildcard '*' can be used to specify all image names. /T Tree kill: terminates the specified process and any child processes which were started by 

它。

与任务列表一起工作良好

您可以在“Windows命令行”中点击F7查看您可以使用键盘select的命令历史logging。

另外…我喜欢这个 – 你可以通过拖拽文件到命令行来复制文件path。

至less在Windows XP上(我没有在Windows Vista和Windows 7上试过):

 appwiz.cpl @,2 

它直接进入“添加/删除Windows组件”窗格。

以自动方式添加或删除组件的另一种方法是使用

 sysocmgr.exe 

在无人参与模式下使用.inf文件列出您想要安装的组件。 例如,

 [NetOptionalComponents] SNMP = 1 [SNMP] Contact_Name = IT Dept. Location = Office Service = Physical, Applications, End-to-End Community_Name = Mormon Traps = server1, server2 Send_Authentication = Yes Accept_CommunityName = Public:Read_Only Any_Host = No Limit_Host = server1, server2 

(由于systemadministrator.com对.inf文件的信任。)

这是一个笨重的工具(嘿,这是MS),但它是非常有价值的安装后,您的组件清理。

装置经理

 devmgmt.msc 

打开

在这里输入图像描述

registry编辑器

 regedit