Jump to content

Recommended Posts

Posted
11 hours ago, boy15 said:

I hit autoiscript

Well, you've been posting here for 4 years and apparently never tried to learn it. I think you could if only you would try.

I'm bored again.

 

Always carry a towel.

  • 3 weeks later...
Posted
#RequireAdmin
#include <AutoItConstants.au3>
#include <WinAPI.au3>

$a_DDriveLetter = DriveGetDrive($DT_REMOVABLE)
For $i = 1 To UBound($a_DDriveLetter) - 1
   $letter = StringReplace(StringUpper($a_DDriveLetter[$i]),":","")
$handle =   FileOpen("script-drive-"&$letter&".txt",2)
    FileWrite($handle,"select volume " &$letter & @CRLF & _
                                             "clean" & @CRLF & _
                                             "create part pri"  & @CRLF & _
                                             "select part 1"  & @CRLF & _
                                             "format fs=ntfs quick"  & @CRLF & _
                                             "active"  & @CRLF & _
                                             "exit" & @CRLF)
 FileClose($handle)
$confirm = MsgBox(0x4,"Confirm","Are you sure you want to make bootable device at letter 
 "&$letter,0,_WinAPI_GetForegroundWindow())
if $confirm = 6 Then 
$pid = Run(@ComSpec & " /C diskpart /s script-drive-"&$letter&".txt",@ScriptDir,@SW_SHOW,0x10000)
ProcessWaitClose($pid)
FileClose($handle)
FileDelete("script-drive-"&$letter&".txt")
endif
Next

But I do not know what is wrong in the  break line

$confirm = MsgBox(0x4,"Confirm","Are you sure you want to make bootable device at letter
 "&$letter,0,_WinAPI_GetForegroundWindow())

Posted

https://www.autoitscript.com/autoit3/files/beta/autoit/docs/intro/lang_comments.htm

Maybe the second sentence on the page will help you understand.  If not, maybe the first example will help you understand.

Posted
4 minutes ago, boy15 said:

Do you try it ?

@boy15

I don't need to try it.  I see the problem. 

I pointed to you to the reason why it isn't working, in the Help file.  I also pointed you to an example in the Help file that should show you how to do what you are trying to do. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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