castelinop
3rd February 2012 08:41 UTC
Let NSIS format USB
Hi,
Using NSIS I have made an installer that lets the user browse to their USB drive and installs my files/folders on the USB's root directory.
But I want to go a step further and instead of the user having to format their USB drive manually beforehand, I want my installer to format it for them.
That is my installer will format the USB drive and then put my files/folders on the USB drive. I would like to know how do I go about doing this and links to any references will be greatly appreciated.
Thanks.
castelinop
4th February 2012 21:55 UTC
Thnx Anders, will look more into it.
demiller9
5th February 2012 00:37 UTC
You can format at the command line, too:
# $USB is the drive letter, $USBVolName is the new name we want to assign
ExpandEnvStrings $0 %COMSPEC%
nsExec::Exec `"$0" /c echo. | Format $USB /Q /X /V:$USBVolName`
Pop $0 ; get the result code (0 = good)
The "echo. |" sends an Enter key to the prompt it asks.
MSG
5th February 2012 09:44 UTC
demiller9: If by prompt you mean entering the volume label, you can use /V:label to enter it as a commandline parameter.
demiller9
5th February 2012 14:52 UTC
MSG: the prompt is "Insert new disk for drive X: and press ENTER when ready" (a chance to *not* format the wrong drive). I already have the /V switch.
castelinop
17th February 2012 21:45 UTC
Thank you
Originally posted by demiller9
You can format at the command line, too:
# $USB is the drive letter, $USBVolName is the new name we want to assign
ExpandEnvStrings $0 %COMSPEC%
nsExec::Exec `"$0" /c echo. | Format $USB /Q /X /V:$USBVolName`
Pop $0 ; get the result code (0 = good)
The "echo. |" sends an Enter key to the prompt it asks.
Thanks demiller9, it was what I needed. Once I knew the syntax to call up the command line I could customize it to me need.