对于普通的Windows用户来说,DOS命令似乎是那个时代的遗物。但是,它们仍然存在并且与几年前一样有用。
为了充分了解这些命令的强大功能,我们编制了一份最有用的DOS命令列表。诚然,其中一些在一般情况下并不是完全有用的。但是,当您确实需要它们时,DOS命令就可以挽救这一天。
如何使用 DOS 命令
第一件事。你如何使用DOS 命令(DOS commands)?
您必须打开命令提示符(Command Prompt)或PowerShell。这两个程序都随Windows一起提供,可以通过Windows Search访问。
某些命令要求您以管理员身份打开任一程序。为此,请右键单击该应用程序并选择Run as Administrator。我们将在以下示例中使用Windows Powershell 。
有用的 Windows 命令提示符
从基本故障排除到网络配置,有一些命令可以让您的计算机再次正常工作。
IPCONFIG
让我们从一些基本的东西开始。
IPCONFIG命令可让您确定您的 IP 地址。在设置网络或遇到互联网问题时,通常需要知道您的 IP 地址。
虽然可以通过控制面板(Control Panel)找到 IP 地址,但命令提示符(Command Prompt)是获取该信息的更快方法。
在命令行中键入IPCONFIG 。查找默认网关(Default Gateway)。分配给它的数字是您的 IP 地址。
IPCONFIG /FLUSHDNS
有时您将无法访问网站。发生这种情况时,您可以尝试的第一件事就是刷新DNS。
这将允许您的浏览器重新连接到网站的常规版本,而不是当前访问的不稳定版本。
在命令行输入IPCONFIG /FLUSHDNS回车(Enter)执行。如果刷新成功,您将收到通知。
协会
如果您需要可以打开特定文件类型的所有应用程序的列表,ASSOC可以提供帮助。
注意:(Note:)您需要使用命令提示符运行(Command Prompt)ASSOC。这在PowerShell(PowerShell)中不起作用。
输入ASSOC,后跟文件扩展名。然后, Windows(Windows)会告诉您哪些应用程序可以使用该扩展。
平
ping 命令可让您连接到网站以查看接收数据包(通过网络传输的数据)需要多长时间。
如果目标网站没有收到这些数据包,则仅表示您的连接存在问题。这是诊断网络问题的简单方法。
在命令行中输入PING 。您将看到发送这些数据包需要多长时间。
密码
除非您使用的是固态驱动器 ( SSD ),否则您可以使用命令行CIPHER擦除硬盘驱动器的内容。
它的工作原理是将无用的文件转储到您的驱动器,直到它用完可用空间。这样,已删除的文件无法恢复。
本质上,CIPHER将擦除驱动器。
输入CIPHER /W: 后跟要清理的驱动器。它应该看起来像CIPHER /W:E:\ (如果您正在擦除E:\ 驱动器)。
证监会 /SCANNOW
当您的 PC 出现故障时,SCANNOW可以弄清楚您的计算机发生了什么。
因此,在将您的 PC 送去维修之前,您需要先进行扫描,以排除丢失或损坏的文件是罪魁祸首。
输入SFC /SCANNOW并等待系统扫描的验证阶段完成。
注意:(Note:)如果发现任何损坏的文件,Windows 将自动使用Windows 资源保护来修复损坏的文件。(Windows Resource Protection)
结论
还有更多的命令行尚未包含在内。有些更复杂,但同样有用。
在紧要关头,这些有用的DOS命令会派上用场,因此请确保您手头有一份清单,以备不时之需。
The DOS Commands Every PC User Must Memorize
To the average Windows user, DOS commands seem like a relic of its time. However, they’re still around аnd are just as useful as they were years ago.
To fully appreciate how powerful these commands are, we’ve compiled a list of the most helpful DOS commands. Granted, some of them are not totally useful on an average day. But when you do need them, DOS commands are there to save the day.
How To Use DOS Commands
First things first. How do you use DOS commands?
You must open either the Command Prompt or PowerShell. Both programs come with Windows and can be accessed through Windows Search.
Some commands require you to open either of the programs as an administrator. To do so, right click on the app and select Run as Administrator. We will be using Windows Powershell in the following examples.
Useful Command Prompts For Windows
From basic troubleshooting to network configuration, there are commands that will get your computer working properly again.
IPCONFIG
Let’s start with something basic.
The IPCONFIG command lets you determine your IP address. The need to know your IP address often comes when setting up your network or when faced with internet issues.
While IP addresses can be found through the Control Panel, the Command Prompt is a faster way of getting that information.
Type IPCONFIG in the command line. Look up Default Gateway. The number assigned to it is your IP address.
IPCONFIG /FLUSHDNS
There comes a point when you will have trouble accessing a site. When that happens, one of the first things you can try is flushing the DNS.
This would allow your browser to reconnect with the regular version of the website and not the wonky one it’s currently accessing.
Enter IPCONFIG /FLUSHDNS in the command line and press Enter to execute. You’ll be notified if the flush was a success.
ASSOC
If you ever need a list of all applications that can open a specific file type, ASSOC can help with that.
Note: You will need to run ASSOC using the Command Prompt. This does not work in PowerShell.
Enter ASSOC followed by the filename extension. Windows will then tell you what applications can work with the extension.
PING
The ping command lets you connect to a website to see how long it would take to receive a packet (data transmitted through a network).
If the target website isn’t receiving those packets, it only means there’s a problem with your connection. It’s a simple way to diagnose a network issue.
Enter PING in the command line. You’ll be shown how long it took to send those packets.
CIPHER
Unless you’re using a solid state drive (SSD), you can wipe the contents of your hard drive with the command line CIPHER.
It works by dumping useless files to your drive until it runs out of free space. This way, deleted files cannot be recovered.
In essence, CIPHER will wipe the drive.
Enter CIPHER /W: followed by the drive you want to clean up. It should look like CIPHER /W:E:\ (if you’re wiping the E:\ drive).
SFC /SCANNOW
When your PC’s gone haywire, SCANNOW can figure out what’s going on with your computer.
So before bringing your PC in for repairs, you’ll want to scan first to rule out missing or corrupted files as a culprit.
Enter SFC /SCANNOW and wait for the verification phase of the system scan to finish.
Note: Windows will automatically use Windows Resource Protection to fix corrupt files should it find any.
Conclusion
There are more command lines out there that have not been included. Some are more complex but are equally useful.
In a pinch, these useful DOS commands will come in handy so make sure you keep a list on hand in case of an emergency.