i2i8 Posted August 24, 2023 Share Posted August 24, 2023 (edited) I have a script like this: Local $GUID, $BootEntryName = "Test" Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD) If StringRegExp(StdoutRead($sPid), '(?i){',3) Then MsgBox(0,0,'Yes') $GUID = _StringBetween(StdoutRead($sPid), "{", "}") ConsoleWrite($GUID[0]) EndIf In the code above, if I comment out the MsgBox , ConsoleWrite does not output any information. Why? Edited August 24, 2023 by i2i8 Link to comment Share on other sites More sharing options...
Solution Andreik Posted August 24, 2023 Solution Share Posted August 24, 2023 Maybe using ProcessWaitClose() before reading stdout will fix it. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
i2i8 Posted August 24, 2023 Author Share Posted August 24, 2023 (edited) 11 minutes ago, Andreik said: Maybe using ProcessWaitClose() before reading stdout will fix it. Thank you so much, you are right, the final code is as follows: Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD) If StringRegExp(StdoutRead($sPid), '(?i){',3) Then ProcessWaitClose($sPid) $GUID = _StringBetween(StdoutRead($sPid), "{", "}") EndIf MsgBox(0,0,$GUID[0]) Edited August 24, 2023 by i2i8 Link to comment Share on other sites More sharing options...
argumentum Posted August 24, 2023 Share Posted August 24, 2023 (edited) try the new and improved _RunWaitEx() now with "real code" PS: ..my head is full of jokes. I hope that the RunWait above get's it done. Edited August 24, 2023 by argumentum joking around Musashi and Andreik 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Andreik Posted August 24, 2023 Share Posted August 24, 2023 11 minutes ago, i2i8 said: Thank you so much, you are right, the final code is as follows: Local $sPid = Run('bcdedit /create /d ' & '"' & $BootEntryName & '"' & ' /application OSLOADER','','', $STDOUT_CHILD + $STDERR_CHILD) If StringRegExp(StdoutRead($sPid), '(?i){',3) Then ProcessWaitClose($sPid) $GUID = _StringBetween(StdoutRead($sPid), "{", "}") EndIf MsgBox(0,0,$GUID[0]) Probably it would be even better if you place the line after Run() and before StringRegExp(). argumentum 1 When the words fail... music speaks. 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