To ‘delete’ an unallocated partition using CMD, you must allocate the space somewhere. Before you do so, you should recover unallocated partition data using a data recovery tool to ensure it’s not overwritten and lost forever. Once you’ve done so, you can allocate the unallocated space using CMD with DiskPart:
Right-click Start and click Terminal (Admin). If you’re on Windows 10, click Windows PowerShell (Admin).
Type diskpart. Press Enter.
Type list disk. Press Enter. Remember the number of your unallocated hard drive.
Type select disk *. Replace * with the number of your unallocated hard drive. If you’re only targeting a portion of the disk, run the commands list volume and select volume * instead.
Type clean. Press Enter.
Type create partition primary. Press Enter.
Type format fs=ntfs quick. Press Enter.
Type assign. Press Enter.