Help - Search - Members - Calendar
Full Version: Is it Possible to Run Diskpart Command from Script?
MSFN Forums > Unattended Windows Discussion & Support > Windows PE

   
Google Internet Forums Unattended CD/DVD Guide
spacesurfer
I'm trying to run diskpart commands from a script but I get errors.

I want to automatically choose a disk and then a partition based on variables that are assigned from the script.

I know diskpart has a "shell" of it's own and the prompt changes to a special diskpart prompt, but was just wondering if it was possible??
zorphnog
The best way to accomplish this is to create a diskpart script on the fly with your variables. The diskpart script is just a simple text file with a diskpart command on each line. Apply it to the system using:

diskpart /s scriptfile.txt
spacesurfer
I'm using diskpart.exe that came with Windows XP and it doesn't seem to work. I wonder it this is a feature of diskpart available in Vista??

The Vista version does not seem to work in XP, however.
zorphnog
What version of diskpart are you using? The diskpart that comes with XP (5.1.3565) supports scripts.
spacesurfer
Yeah, the one that came with XP. Version 5.1.3565.0.

I created a txt file with a simple script: list disk.

Just learned something new: when I run it from a cmd script, it gives me error:

CODE
DiskPart was unable to process the parameters.
Use 'diskpart /?' for more information.


When I run it at command prompt, no error and it does it correctly.

I made sure all filenames were typed correctly.

?? Puzzleds huh.gif ??

Edit: nevermind .... blond moment.... I was calling the wrong label in the script....
Variables in the text file works well.

Thanks for help everyone.
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.