Jump to content

Recommended Posts

Posted

Hello,

I've got kinda strange issue with diskpart.. i use this code down below, everything in it works, but the "assign letter=C" doesn't, it returns failure "The arguments specified for this command are not valid. For more information on the command type: HELP ASSIGN, if I try to type it manually in cmd, it does work. I use it in Windows PE. What's the issue?

ConsoleWrite("Diskpart" & @CRLF)
FileWrite(@TempDir & "diskpart_clean.txt", "select disk " & $sDisk & @CRLF & "clean" & @CRLF & "create partition primary" & @CRLF & "format quick fs=ntfs" & @CRLF & "active" & @CRLF & "assign letter=C")
RunWait ("diskpart /s " & @TempDir & "diskpart_clean.txt", "", @SW_SHOW)

Thank you

Dave

Posted (edited)

@D_K

as what @Nine says:you need to add \

your script should look like this:

ConsoleWrite("Diskpart" & @CRLF)
FileWrite(@TempDir & "\diskpart_clean.txt", "select disk " & $sDisk & @CRLF & "clean" & @CRLF & "create partition primary" & @CRLF & "format quick fs=ntfs" & @CRLF & "active" & @CRLF & "assign letter=C")
RunWait ("diskpart /s " & @TempDir & "\diskpart_clean.txt", "", @SW_SHOW)

 

Edited by ad777

none

Posted

Changed my code to

ConsoleWrite("Diskpart" & @CRLF)
FileWrite(@TempDir & "\clean.txt", "select disk " & $sDisk & @CRLF & "clean" & @CRLF & "create partition primary" & @CRLF & "format quick fs=ntfs" & @CRLF & "active" & @CRLF & "assign letter=C")
RunWait ("diskpart /s " & @TempDir & "\clean.txt", "", @SW_SHOW)

(added \ and changed clean.txt instead of diskpart_clean.txt so i don't have to specify full path).. yet still same issue

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