检查磁盘(Check Disk)或Chkdsk.exe是一个内置的Windows实用程序,用于检查磁盘介质和文件系统中的错误。如果您遇到从蓝屏到无法打开或保存文件或文件夹的问题,可以运行检查磁盘(Check Disk)实用程序。每当我们需要检测和修复文件系统或磁盘损坏时,我们都会运行内置的Windows 检查磁盘工具(Windows Check Disk tool)。检查磁盘实用(Check Disk)程序(ChkDsk.exe)或ChkDsk.exe检查文件系统错误、坏扇区(bad sectors)、丢失的簇等。Check Disk可以在突然关闭或发现文件系统“脏”的情况下自动运行。
我们可以说在Windows 11/10中有这个实用程序的“两个版本” 。一个是我们大多数人使用的基本版本,另一个是命令行版本,它有更多的选项集。检查磁盘实用程序的基本版本可按如下方式访问:
Open Computer > Right-click Drive > Properties > Tools tab > Check Now.
在这里,您可以选择自动修复文件系统错误(Automatically Fix File System Errors)以及扫描并尝试恢复坏扇区(Scan For And Attempt Recovery Of Bad Sectors)。
如果要检查的驱动器正在使用中,您可能必须在重新启动时安排 chkdsk。
命令行 ChkDsk
然后是 chkdsk 的这个命令行版本,它为您提供了几个选项,除了允许您使用Task Scheduler设置定期磁盘检查。
要使用命令行检查磁盘版本,请使用“以管理员身份运行”(Command Prompt using the ‘Run As Administrator’) 选项打开命令提示符。 在提示符处键入chkdsk 。这将以只读模式运行Chkdsk并显示当前驱动器的状态。(Chkdsk)
输入chkdsk /?并按Enter将为您提供其参数或开关。
要获取例如驱动器 C 的报告,请使用chkdsk c:。
您还可以在命令末尾使用以下参数来专门化其操作。
The following are valid on FAT32 / NTFS volumes.
- /f 修复检测到的错误。
- /r 识别坏(Bad) 扇区(Sectors)并尝试恢复信息。
- /v FAT32上每个目录中每个文件的列表。在NTFS上,显示清理消息。
以下内容仅对NTFS卷有效。
- /c 跳过(Skips)文件夹结构中的循环检查。
- /I 对索引条目执行更简单的检查。
- /x 强制卸载卷。还会使所有打开的文件句柄无效。在Windows的(Windows)桌面版(Desktop Editions)中应该避免这种情况,因为可能会丢失/损坏数据。
- /l[:size] 它更改记录NTFS事务的文件的大小。与上述选项一样,此选项也仅(ONLY)适用于服务器管理员。
- 请注意,当您启动到 Windows 恢复环境时,可能只有两个开关可用。(Do note that, when you boot to the Windows Recovery Environment, Only two switches may be available.)
- /p 它对当前磁盘执行详尽的检查
- /r 它修复当前磁盘上可能存在的损坏。
以下开关仅适用于NTFS卷上的Windows 11/10, Windows 8
- /scan运行在线扫描
- /forceofflinefix 绕过(Bypass)在线修复和队列缺陷以进行离线修复。需要与 /scan 一起使用。
- /perf 尽可能快地执行扫描。
- /spotfix 在离线模式下执行现场修复。(Perform)
- /offlinescanandfix 运行(Run)脱机扫描并执行修复。
- /sdcclean垃圾收集。
Windows 11/10仅在FAT/FAT32/exFAT卷上支持这些开关:
- /freeorphanedchains释放所有孤立的集群链
- /markclean 如果未检测到损坏,则将卷标记为干净。(Mark)
另请注意:
- ChkDsk /f扫描并尝试修复文件系统中的错误。
- ChkDsk /r包括 /f,但它也会扫描整个磁盘表面以查找物理错误并尝试修复它们。
因此,您可以运行如下命令来检查和修复 C 驱动器上的磁盘错误:
chkdsk c: /r
取消 CHKDSK 扫描
要取消计划检查,请在命令提示符处键入
chkntfs /x d:
然后按 Enter。这里d是驱动器号。
Windows 11/10的用户可能已经注意到磁盘错误检查与早期版本的(Disk Error Checking)Windows有点不同。阅读这篇关于Windows 中磁盘错误检查的文章以了解更多信息。
这篇关于如何格式化外部驱动器或使用命令提示符运行检查磁盘(format External Drive or run Check Disk using Command Prompt )的帖子可能会让你们中的一些人感兴趣。
ChkDsk Command Line Options, Switches, Parameters in Windows 11/10
Check Diѕk or Chkdsk.exe іs a built-in Windows utility used to check for errors in the disk media and in the file ѕystem. If you face problems ranging from blue sсreens, to inability to open or savе files or folders, one can run the Check Disk utility. Whenever we need to detеct and fix thе file system or disk corruрtion, we run the built-in Windows Check Disk tool. The Check Disk utility or ChkDsk.exe checks file system errors, bad sectors, lost clusters, and so on. Check Disk can run automatically, in the case of an abrupt shutdown or if it finds the file system to be ‘dirty’.
We can say that there are “two versions” of this utility in Windows 11/10. One is the basic version which most of us use and the other is the command-line version, which has more sets of options. The basic version of the Check Disk utility can be accessed as follows:
Open Computer > Right-click Drive > Properties > Tools tab > Check Now.
Here you have options to Automatically Fix File System Errors and Scan For And Attempt Recovery Of Bad Sectors.
You may have to schedule the chkdsk at reboot if the drive to be checked, is in use.
Command Line ChkDsk
And then there is this command-line version of chkdsk, which offers you several options, apart from just allowing you to set up regular disk checking using the Task Scheduler.
To use the command line check disk version, open a Command Prompt using the ‘Run As Administrator’ option. Type chkdsk at the prompt. This will run Chkdsk in a Read-Only mode and display the status of the current drive.
Typing chkdsk /? and hitting Enter will give you its parameters or switches.
To get a report for, say, drive C, use chkdsk c:.
You can also use the following parameters at the end of the command to specialize its operations.
The following are valid on FAT32 / NTFS volumes.
- /f Fixes errors detected.
- /r Identifies Bad Sectors and attempts recovery of information.
- /v Displays a list of every file in every directory, on FAT32. On NTFS, is displays the cleanup messages.
The following are valid on NTFS volumes only.
- /c Skips the checking of cycles within the folder structure.
- /I Performs a simpler check of index entries.
- /x Forces the volume to dismount. Also invalidates all open file handles. This should be avoided in Desktop Editions of Windows, because of the possibility of data loss/corruption.
- /l[:size] It changes the size of the file that logs NTFS transactions. This option too, like the above one, is intended for server administrators ONLY.
- Do note that, when you boot to the Windows Recovery Environment, Only two switches may be available.
- /p It performs an exhaustive check of the current disk
- /r It repairs possible damage on the current disk.
The following switches work in Windows 11/10, Windows 8 on NTFS volumes only:
- /scan Run online scan
- /forceofflinefix Bypass online repair and queue defects for offline repair. Needs to be used along with /scan.
- /perf Perform the scan as fast as possible.
- /spotfix Perform spot repair in offline mode.
- /offlinescanandfix Run offline scan and perform fixes.
- /sdcclean Garbage collection.
These switches are supported by Windows 11/10 on FAT/FAT32/exFAT volumes only:
- /freeorphanedchains Free up any orphaned cluster chains
- /markclean Mark the volume clean if no corruption is detected.
Also note:
- ChkDsk /f scans for and attempts to repair errors in the file system.
- ChkDsk /r includes /f, but it also scans the entire disk surface for physical errors and attempts to repair them as well.
So you could run a command like the following to check and repair disk errors on your C drive:
chkdsk c: /r
Cancel a CHKDSK scan
To cancel a scheduled check, at a command prompt, type
chkntfs /x d:
and hit Enter. Here d is the drive letter.
Users of Windows 11/10 may have noticed that Disk Error Checking is a bit different from the earlier versions of Windows. Read this post on Disk Error Checking in Windows to learn more.
This post on how to format External Drive or run Check Disk using Command Prompt may interest some of you.