I am trying create a Do While loop that will run a cmd /c command and write the content to a out-file text file, from there the i will loop through my do while loop until the string i want appears. However when i try to issue the cmd /c command the out-file remains open and the scripts hangs unable to progress forward. If i comment out the cmd /c the loop moves forward.
You said you’re running the command and from there looping. That’s not the case. You’re running the command inside your Do loop, and each time, it will overwrite the previous output.txt. Each time, it’s reading in the output.txt and running Select-String. That doesn’t appear to match what you said.
In terms of it hanging, without knowing what JBoss is doing exactly on your system, I honestly have no idea. I would probably insert a breakpoint at line 6 and then manually run the JBoss file in break mode.
That is what i intended to do with each loop overwrite the output.txt each time. As for jboss it self it runs a query to show me what files are active this works (i am waiting for a file to appear), but the loop does not appear to progress past this point it stops and holds the output.txt file in a open state.