Skip to content
⌘ NSIS Forum Archive

Execute diskpart

11 posts

ChocJunkie#

Execute diskpart

Hi,

I'm trying to execute the 'diskpart' command during installation. I've tryed using ExecWait, nsExec::exec, ExecDos::exec and ExecCmd::exec but it seems I'm doing something wrong, because the command never succeeds.
ExecWait '"diskpart" /s $\"C:\Documents and Settings\Administrator\Desktop\test.txt$\"'
${If} ${Errors}
...
${EndIf}
What am I doing wrong? >.<

Thanks. 🙂

CJ
ChocJunkie#edited
I've tried calling the program directly from path C:\WINNT\system32\diskpart.exe. Nothing has changed - the command fails.
Thanks anyway, MSG.

That can't be normal, because what are the Exec commands and plugins for if it is not possible to call a executable!?

If anyone wants to test it: You can use a empty file so that your system stays healthy. 😉

[ADDED]

I forgot to say, I can execute
ExecCmd::exec "wmic ... "
successfully. I just kind of don't get whats the big difference!?
CG!#
Re: Execute diskpart

Try
ExecWait "cmd /c %windir%\system32\diskpart /s %userprofile%\Desktop\test.txt"
Maybe this helps.
ChocJunkie#
Sorry, I'm not realy into the "System" plug-in right now, but is it possible to execute the command using the plug-in?
ChocJunkie#
Ok, I've tried calling "diskpart" from inside a batch file.
I've I'm executing the batch manualy, everything works correct. When I'm calling the batch using my installer, I get a error message that's ... not nice.
'diskpart' is not recognized as an internal or external command, operable program or batch file.
Return code: 9009
Any idea for a workaround?

Thanks. 🙂

CJ
demiller9#
diskpart.exe

The exec commands you are using are not adding an extension and cannot find the file without it.
ChocJunkie#
I simply don't get it ... I've tried the exec functions from different plug-ins, I've tried calling 'diskpart', 'diskpart.exe', 'C:\WINNT\system32\diskpart.exe' and I've tried executing the command by calling it through a batch file.

Does someone know why I can call 'wmic' using ExecCmd::exec but can't call 'diskpart'?!

The problem is, I realy need this functionality. >.<
ChocJunkie#
Ok, sorry for all the trouble. The problem has been found. On normal windows the installer works fine, but I've used it on a special windows version.

Thanks for all help! 🙂

CJ
ChocJunkie#
Ok, even when using x64.nsh calling diskpart.exe fails.
It's neither mine nor NSIS' fault - Micrsoft itself is causing the proplem.
Even if looking for exactly C:\windows\system32\diskpart.exe Windows is redirecting the call will to C:\windows\sysWoW64\diskpart.exe. Because that file is missing, the call fails.

Further information: http://www.itnewsgroups.net/group/mi...topic8160.aspx

Greetings,
CJ