I am a little bit confused about the purpose of the following line in the code:

SW.Writeline("exit")

What is this line for? The comment says 'exits command prompt window, but does this mean that the cmd window is now closed, or what?

What I need is for the cmd window to remain open at all times, displaying its messages in my TextBox, accepting and executing commands, and displaying the results, until I close the application.

What do I need to do to the code to achieve this?

TIA

Rock