Jump to content

Is it Possible to Run Diskpart Command from Script?


Recommended Posts

Posted

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??


Posted

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

Posted (edited)

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.

Edited by spacesurfer
Posted (edited)

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:

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: ??

Edit: nevermind .... blond moment.... I was calling the wrong label in the script....

Variables in the text file works well.

Thanks for help everyone.

Edited by spacesurfer

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...