Windows 常用命令记录(updating...)

# win2012 win2016 显示桌面图标

rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0

# 常用功能界面命令

diskmgmt.msc  磁盘管理

compmgmt.msc  计算机管理

lusrmgr.msc  用户与组

devmgmt.msc 设备管理器

perfmon.msc 计算机性能检测程序

notepad  记事本

mspaint  画图

eventvwr  事件查看器

 

# 防火墙相关

允许被Ping, 命令:

netsh firewall set icmpsetting 8

禁止被Ping, 命令:

netsh firewall set icmpsetting 8 disable

# CMD 有趣命令

systeminfo |findstr /b /c:"OS name" /c:"OS Version"    # 有点像grep -E "A|B"

dir /t:a[c,w]

/T Controls which time field displayed or used for sorting
timefield

C Creation      文件创建时间
A Last Access   文件访问时间 (# 包括复制,双击,右键
W Last Written   文件修改时间

# 循环,快速ping尝试扫描某段IP地址,可ping主机

for /l %I in (1,1,254) do @ping -w 1 -n 1 192.168.1.%I | findstr "TTL="  

# 勒索病毒相关排查所使用的命令

systeminfo  # 系统信息及补丁查看

netstat -ano # 本机开放端口查看

eventvwr.msc  # 事件查看器

# Microsoft 安全公告 MS17-010 

https://docs.microsoft.com/zh-cn/security-updates/securitybulletins/2017/ms17-010

# 官方给出的验证MS17-010 方法

https://support.microsoft.com/zh-cn/help/4023262/how-to-verify-that-ms17-010-is-installed

S/N序列号 :wmic bios get serialnumber
查看bios版本 :wmic bios get releasedate  # 这个bios版本的命令可以用于判断补丁有没有打?待考证

关于笔者参考的:参考:https://blog.csdn.net/u010050174/article/details/81179097  里面提到了重要的一个问题

(对于自查的版本在附件中不存在的不需修复,如我的版本1909不存在,但是存在“永恒之黑”(KB4551762)SMBv3)

# Windows 家庭版 OR 家庭高级版没有组策略,添加方法

@echo off

pushd "%~dp0"

dir /b C:WindowsservicingPackagesMicrosoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt

dir /b C:WindowsservicingPackagesMicrosoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt

for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"C:WindowsservicingPackages\%%i"

pause

# 常见端口关闭

关闭135端口

“开始”——“运行”,输入“dcomcnfg”,单击“确定”,打开组件服务。

“组件服务”对话框中,选择“计算机”选项。

“计算机”选项右边,右键单击“我的电脑”,选择“属性”。

“我的电脑属性”对话框“默认属性”选项卡中,去掉“在此计算机上启用分布式COM”前的勾。

选择“默认协议”选项卡,选中“面向连接的TCP/IP”,单击“删除”按钮。

关闭139端口

右键“本地连接”图标,选择“状态”。

“本地连接状态”对话框中,单击“属性”按钮。

“本地连接属性”对话框中,选择“Internet协议(TCP/IP)”,双击打开。

“Internet协议(TCP/IP)属性”对话框中,单击“高级”按钮。

“高级TCP/IP设置”对话框中,选择“WINS”选项卡。

“WINS”选项卡,“NetBIOS设置”下,选择“禁用TCP/IP上的” NetBIOS。

# win CMD command 集中整理
【wmic】
wmic product get name,version # 查看本机安装软件及版本
wmic service list brief # 查询本机服务信息
wmic process list brief # 查询本机进程信息
wmic startup get command,caption # 查看开机启动程序
wmic qfe get Caption,Description,HotFixID,InstalledOn # 查询安装在系统中的补丁
wmic share get name,path,status # 查询共享
wmic path win32_terminalservicesetting where (__CLASS !="") call setallowtsonnections 1 # win2003开启3389
# win2008及以上开启3389
wmic /namespace:\rootcimv2 erminalservices path
win32_terminalservicesetting where (__CLASS !="") call setallowtsconnections 1

【powershell】
Get-WmiObject -class Win32_product |Select-Object -Property name, version # 查看本机安装软件及版本(Powershell版本)

【net】
net statistics workstation # 查看计算机开机时间
net localgroup administrators # 查询管理员组
net user # 查询用户
net share # 查询共享

【其他】
tasklist # 进程查看
query user || qwinsta.exe 查询在线用户
route print # 查看路由表
arp -a # mac 地址绑定

【netsh】
# win2003及以前的系统
netsh firewall set opmode disable # 防火墙关闭
netsh firewall add allowedprogram c:xx.exe "allow nc" enable # 允许xxx.exe 防火墙通过

# win2003 以上的系统
netsh advfirewall set allprofiles state off #防火墙关闭
netsh advfirewall firewall add rule name="pass xxx" dir=in action=allow program="c:xxx.exe" # 允许xxx.exe 防火墙通过
netsh advfirewall irewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow # 允许TCP3389通过防火墙
netsh advfirewall set currentprofile logging filename "C:xxxfw.log" # 自定义防火墙日志文件路径

【注册表】
# 查询注册表服务器代理端口的配置
reg query "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"
# 查询注册表 远程端口
reg query "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp" /v PortNumber
0xd3d(十六进制) = 3389
# 开启3389
reg add "HKLMSYSTEMCURRENTCONTROLSETCONTROLTERMINAL SERVER" /v fSingleSessionPerUser /t REG_DWORD /d 0 /f

原文地址:https://www.cnblogs.com/Cong0ks/p/12055623.html