A site moved to a new IP address, I changed a record, and Windows still goes to the old one. Before I blame the DNS server, I empty the cache on the PC.
The /flushdns option of ipconfig flushes and resets the contents of the DNS client resolver cache. Microsoft’s description adds that during DNS troubleshooting you can use it to discard negative cache entries, which are the remembered “this name does not exist” answers, as well as any other entries that were added dynamically.
ipconfig /flushdns
The matching command for looking before you flush is /displaydns, which shows the resolver cache, including entries preloaded from the hosts file and recently obtained records. Looking first tells you whether the stale answer is in the PC’s cache at all:
ipconfig /displaydns
A situation where this helps: you created a new DNS record for a service on your home network, you tried the name once before the record existed, and Windows now keeps the failed answer. After the flush, the next lookup asks the DNS server again. The same goes for a changed address after you moved a service to another machine.
The caveat is about what the command does not touch. It clears only the cache of this Windows machine. A router, a Pi-hole or any other resolver in the chain keeps its own cache, and so does a browser, so a name can stay wrong after the flush. If the answer is still old after the flush, it comes from one of those other places, and flushing the PC a second time will not change anything. Clear or wait out the cache there instead.
Further reading: ipconfig