C# Windows Form .Net and DOS Console

前端 未结 6 785
走了就别回头了
走了就别回头了 2020-12-04 02:50

I have a windows form that executes a batch file. I want to transfer everything that happends in my console to a panel in my form. How can I do this? How can my DOS console

6条回答
  •  借酒劲吻你
    2020-12-04 03:01

    I'm pretty sure there are better options but you can route the output of the command to a temp file

    Redirecting Command-Line Output to Files

    For programs that display a lot of text, consider redirecting text that is usually displayed on stdout to a file. Displaying a lot of text will slow down execution; scrolling text in a terminal window on a workstation can cause an I/O bottleneck (increased elapsed time) and use more CPU time.

    The following commands show how to run the program more efficiently by redirecting output to a file and then displaying the program output:

    myprog > results.lis more results.lis Redirecting output from the program will change the times reported because of reduced screen I/O.

    I think you could just route it to a variable as well, not 100% sure though. There's probably far better options but at least this is one.

提交回复
热议问题