D_K Posted February 1, 2022 Share Posted February 1, 2022 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 Link to comment Share on other sites More sharing options...
Nine Posted February 1, 2022 Share Posted February 1, 2022 @tempdir does not end with a backslash. You need to add this before you file name. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
ad777 Posted February 1, 2022 Share Posted February 1, 2022 (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 February 1, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Nine Posted February 1, 2022 Share Posted February 1, 2022 You might also need to put your whole path within double-quotes in the RunWait statement (as Windows requests it when there are spaces or special characters). “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
D_K Posted February 1, 2022 Author Share Posted February 1, 2022 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 Link to comment Share on other sites More sharing options...
ad777 Posted February 1, 2022 Share Posted February 1, 2022 @D_K here is full Command Parameters:Commands Parameters Link iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Nine Posted February 1, 2022 Share Posted February 1, 2022 How about checking for error code ? Who would thought about it ! How about following suggestions made to you ? Man, that is crazy ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now