MSFN Forum: Diskpart cmd almost 75% complete - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Diskpart cmd almost 75% complete diskpart cmd which ask the input from user Rate Topic: -----

#1 User is offline   sayyed.ali1981 

  • Advance User
  • Group: Members
  • Posts: 20
  • Joined: 18-April 09
  • OS:Windows 7 x86
  • Country: Country Flag

  Posted 28 February 2011 - 06:58 PM

Hi guys,

finally got the diskpart to work with cmd with full automated funcnality still in progress, almost 75% codeing has been done,check out the final.txt and comment on it for further editing.

@ECHO OFF
COLOR 9A

:begin
CLS
ECHO.
ECHO Welcome to Diskpart Which will create partition automaticaly
ECHO Warning it will wipe your data completely
ECHO If selected wrong disk be carefull while selecting
ECHO off
echo>list.txt
echo>list.txt list disk
@echo off
diskpart -s list.txt
@echo off
SET /P disk= Choose a disk:
if ‘%disk%’ == ‘5’ goto 5
if ‘%disk%’ == ‘4’ goto 4
if ‘%disk%’ == ‘3’ goto 3
if ‘%disk%’ == ‘2’ goto 2
if ‘%disk%’ == ‘1’ goto 1
if ‘%disk%’ == ‘0’ goto 0
goto error

:error
echo.
echo The disk letter you entered was not recognized
echo.
pause
goto begin

:0
echo:
echo>select.txt
echo>select.txt select disk 0
@echo off
diskpart -s select.txt
echo.
echo Would you like to Create a new partition.
echo.
echo Type C for Create partition or wanna edit volume
echo Type E to see the volume
SET /P ok= Choose a option:
if ‘%ok%’ == ‘c’ goto yes
if ‘%ok%’ == ‘C’ goto yes
if ‘%ok%’ == ‘e’ goto no
if ‘%ok%’ == ‘E’ goto no
goto error

:error
echo.
echo The letter you entered was not recognized
echo.
pause
goto begin

:no
echo.
echo Select volume
echo be carefull will selecting
echo.
echo>volume.txt
echo>volume.txt list volume
@echo off
diskpart -s volume.txt
echo off
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%
pause
echo select volume=%INPUT% >>selectvolume.txt
diskpart -s selectvolume.txt

:yes
echo:
echo>active.txt
echo>active.txt active
@echo off
diskpart -s active.txt

echo.
echo Put size u want for partition.example size in 1024 mb
echo The size will be in MB not GB
echo.
echo off
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%
pause
echo CREATE PARTITION Primary Size=%INPUT% >>create part.txt

goto error

:error
echo.
echo The disk letter you entered was not recognized
echo.
pause
goto begin

:end
echo Thank you for using this tool
Del /f "list.txt"
Del /f "volume.txt"
Del /f "select.txt"
pause
exit

Attached File(s)

  • Attached File  final.txt (2.01K)
    Number of downloads: 29

This post has been edited by sayyed.ali1981: 03 March 2011 - 05:16 PM



#2 User is offline   diskpart1234 

  • Group: Members
  • Posts: 4
  • Joined: 18-September 11
  • OS:none specified
  • Country: Country Flag

Posted 19 September 2011 - 12:44 PM

wow man, looks awesome.

I was writing similas thing myself.

...though i got to the part where user selects diks and gets message that disk X is selceted.


I cant incorporate "clean" command afterwards.

I ant user to get Questio anfter choosing disk if disk needs to be cleaned but I dont kn ow...can t make it work.

Any Ideas???

#3 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 20 September 2011 - 01:07 PM

I haven't even checked the posted code, but there is a trick to embed diskpart commands inside a batch, check this thread here:
http://www.msfn.org/...ter-batch-file/

jaclaz

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy