如何在 JPowershell 中使用 "chkdsk"?

how to use "chkdsk" with JPowershell?

我想知道如何通过Java或Powershell获取硬盘驱动器的坏扇区。

我在使用 JPowershell 库的 chkdsk 命令时遇到了一些问题。我曾经像

那样执行
PowerShellResponse response = PowerShell.executeSingleCommand("chkdsk");
    return response.getCommandOutput();

PowerShellResponse response = PowerShell.executeCommand("chkdsk");
    return response.getCommandOutput();

我运行都在管理模式下,但是他们都return输出为

The type of the file system is NTFS.

在 powershell 中执行 chkdsk 的问题是获取信息需要一些时间,之后就只显示数据了。

一段时间后,我找到了 JPowershell 不能用于此的答案,而是使用了 java 运行时进程,因为 chkdsk 命令动态获取数据。因此我不得不手动执行和检索数据