Python Forum

Full Version: How to run diskpart from python script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Everyone,

I'm looking to wipe several laptop drives using a bootable usb and a python script that will run diskpart and the list disk, select disk etc... commands.

Would anyone be able to help me with code that will run diskpart and then run;
list disk
select disk 0
clean
etc......

Cheers Greg
Not a Windows user here, but there is a module infi.diskmanagement in Pypi that says

Quote:This module gives the same functionality as diskpart. But unlike diskpart, it does not use VDS, it uses SetupAPI and direct IOCTLs to the disks, volumes, and the mount and partitions managers

It could be worth trying.