查看 Windows 的 DNS 缓存记录
用 Get-DnsClientCache 查看本机缓存的域名解析结果,再决定是否刷新。
运行 `Get-DnsClientCache | Format-Table Entry, Data, TimeToLive -AutoSize`,即可看到每条缓存的域名及其解析到的 IP。
01命令
命令
$ Get-DnsClientCache | Format-Table Entry, Data, TimeToLive -AutoSize02作用说明
Windows 会缓存所有 DNS 查询结果来加快上网速度,但过期或被污染的缓存条目可能把你带到错误的服务器。Get-DnsClientCache 会列出每条缓存记录、对应的 IP 和剩余有效期(TimeToLive),可以确认某个域名是不是在用缓存应答。发现条目不对时,运行 `ipconfig /flushdns` 清空后重新解析。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-DnsClientCache依据: Retrieves the contents of the local DNS client cache, including entry names and record data.
- netsh依据: Documents netsh WLAN commands including `netsh wlan show profile name=... key=clear` and `netsh wlan delete profile name=...`.
最后验证: 2026-09-18 · 分类: 网络