- NSIS Discussion
- Execute diskpart
Archive: Execute diskpart
ChocJunkie
14th December 2009 12:13 UTC
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
    
    
      MSG
      14th December 2009 13:00 UTC
      Diskpart is an executable, not a command. Try supplying a full path to the exe file.
     
    
    
      ChocJunkie
      14th December 2009 13:20 UTC
      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!
      14th December 2009 13:46 UTC
      Re: Execute diskpart
      Try
      ExecWait "cmd /c %windir%\system32\diskpart /s %userprofile%\Desktop\test.txt"
      Maybe this helps.
     
    
    
      ChocJunkie
      14th December 2009 13:57 UTC
      Thanks, but it doesn't help. :(
     
    
    
      ChocJunkie
      14th December 2009 15:34 UTC
      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
      14th December 2009 16:41 UTC
      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
      14th December 2009 16:46 UTC
      diskpart.exe
      
      The exec commands you are using are not adding an extension and cannot find the file without it.
     
    
    
      ChocJunkie
      15th December 2009 07:57 UTC
      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
      15th December 2009 09:05 UTC
      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
      5th January 2010 14:12 UTC
      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