Click here to Skip to main content
15,851,395 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
list volum
select disk 0
clean
create partition primary
select partition 1
format fs=ntfs label="windows" quick
assign letter=c
active
exit


i need to write the script in python which will automated above category .

What I have tried:

https://github.com/Duoquote/python-diskpart/blob/5e63cddcec39b163944faf9365d393a43ea866b4/main.py#L47[^]



here execute listdisk() i am geting issue
how do i solve the issue
Posted
Updated 2-Feb-23 5:15am
v2
Comments
Richard MacCutchan 2-Feb-23 7:49am    
You have not explained what the problem is with the above script.
HelpMewithCode 2-Feb-23 8:44am    
above script dont have any problem but i want to assign disk letter

I need same kind of code
https://github.com/Duoquote/python-diskpart/blob/master/main.py
when i try fetch list disk command i was getting error like "int cant split "
template = result.split("\n")[0] #line 57
please can you help me how to ressolve this
thank you
Richard MacCutchan 2-Feb-23 9:54am    
If you have a problem then please use the Improve question link above, and add complete details into your question.
Richard MacCutchan 2-Feb-23 10:18am    
Please do what I suggested in my previous reply. We need all information here in the question, not on other sites. If you found some code on the internet that does not work then you need to talk to the person who write it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900