Computer Hope

Microsoft => Microsoft DOS => Topic started by: seferismo on September 23, 2009, 10:14:36 PM

Title: DISKPART bat
Post by: seferismo on September 23, 2009, 10:14:36 PM
hi to all i just join this wonderful forum. i like computers and stuff like these kind of taste of programming, since i dont study programming my knowledge is bit little.



my point is i want to make a batch file to run DISKPART

 i started with still line
START C:\Windows\SYSTEM32\DISKPART.EXE

now for the part where i would need to set to choice to SELECT VOLUME 3 how do i add these kind of paremeters??? thanks  ;D
Title: Re: DISKPART bat
Post by: Salmon Trout on September 24, 2009, 12:49:51 AM
You would create a text file with the commands you want Diskpart to execute, and then invoke Diskpart with the textfile path and name as one of the parameters.

http://blogs.msdn.com/embedded/archive/2005/12/23/506404.aspx

http://support.microsoft.com/default.aspx?scid=kb;en-us;300415

Title: Re: DISKPART bat
Post by: ourfear on September 25, 2009, 07:09:15 AM
I actually wrote a batch file using diskpart and turned it into a USB Pen Drive Letter switching executable. The problem is that you cant hard code the Volume selection or the drive letter to assign it to!! So what i did was take the users input, export it into a text file and then run disk part against the text file using the -s (script)parameter.

Here's my code if you'd like to take a look and the executable itself can be downlaoded from here:
 http://feartechsolutions.proboards.com/index.cgi?board=feartechprograms&action=display&thread=1 (http://feartechsolutions.proboards.com/index.cgi?board=feartechprograms&action=display&thread=1)

Code: [Select]
@echo off
color 0E
mode con lines=22 cols=86
echo>list.txt
echo>list.txt list volume
@echo on
diskpart -s list.txt
@echo off
set /p DLA=Enter desired volume:
echo:
set /p LTT=Enter drive letter:
echo:
echo>move.txt
echo>move.txt list volume
echo>>move.txt select volume %DLA%
echo>>move.txt assign letter=%LTT%
@echo off
diskpart -s move.txt
echo:
Del /f "list.txt"
Del /f "move.txt"
echo:
echo:
pause
exit /b

Hope this helps  :D

Russ