Hello here is a method from diskpart on how to remove bad sectors from hard disk via CMD
You can use the Windows built-in tool to remove bad sectors from hard disk. CHKDKS command prompt is a free built-in tool, and it can be used to check the integrity of a file system and bad sectors of a disk. And find and fix bad sectors, errors, or any other disk problems. Here are the specific steps of removing bad sectors from the hard disk via CMD:
1. Press “Windows” + “R” to open the Run box, typing “cmd” in it and press “Enter”.
2. Input “chkdsk g: /f /r /x” and press “Enter”. (Here “g” is the drive letter of the disk you want to check.)
This option will run the CHKDSK to check and repair bad sectors or other disk errors on G: volume. The “/f” parameter tells CHKDSK to fix any errors it finds, “/r” tells it to locate the bad sectors on the drive and recover readable information, and “/x” forces the drive to dismount before the process starts.
And now you can see the information of the disk such as disk space parameters, file size, and the number of bad sectors.