Python Forum
How to run diskpart from python script - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to run diskpart from python script (/thread-28843.html)



How to run diskpart from python script - obgocs - Aug-06-2020

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


RE: How to run diskpart from python script - Gribouillis - Aug-06-2020

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.