• <small id='Wn6br'></small><noframes id='Wn6br'>

    • <bdo id='Wn6br'></bdo><ul id='Wn6br'></ul>
    <i id='Wn6br'><tr id='Wn6br'><dt id='Wn6br'><q id='Wn6br'><span id='Wn6br'><b id='Wn6br'><form id='Wn6br'><ins id='Wn6br'></ins><ul id='Wn6br'></ul><sub id='Wn6br'></sub></form><legend id='Wn6br'></legend><bdo id='Wn6br'><pre id='Wn6br'><center id='Wn6br'></center></pre></bdo></b><th id='Wn6br'></th></span></q></dt></tr></i><div id='Wn6br'><tfoot id='Wn6br'></tfoot><dl id='Wn6br'><fieldset id='Wn6br'></fieldset></dl></div>

        <tfoot id='Wn6br'></tfoot>
        <legend id='Wn6br'><style id='Wn6br'><dir id='Wn6br'><q id='Wn6br'></q></dir></style></legend>

        如何从 WPF 应用程序写入命令行?

        时间:2023-08-27

        <legend id='zWkct'><style id='zWkct'><dir id='zWkct'><q id='zWkct'></q></dir></style></legend>

        <small id='zWkct'></small><noframes id='zWkct'>

            <tbody id='zWkct'></tbody>

                <bdo id='zWkct'></bdo><ul id='zWkct'></ul>
                <tfoot id='zWkct'></tfoot>
                <i id='zWkct'><tr id='zWkct'><dt id='zWkct'><q id='zWkct'><span id='zWkct'><b id='zWkct'><form id='zWkct'><ins id='zWkct'></ins><ul id='zWkct'></ul><sub id='zWkct'></sub></form><legend id='zWkct'></legend><bdo id='zWkct'><pre id='zWkct'><center id='zWkct'></center></pre></bdo></b><th id='zWkct'></th></span></q></dt></tr></i><div id='zWkct'><tfoot id='zWkct'></tfoot><dl id='zWkct'><fieldset id='zWkct'></fieldset></dl></div>

                • 本文介绍了如何从 WPF 应用程序写入命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  您好,我知道如何写入控制台,但是如果我在程序中写入控制台并从命令行调用我的程序,它将不会显示任何内容.

                  Hi I know how to write to console but if I write to console in my program and call my program from the command line it won't display anything.

                  如何做到这一点,以便当我说 Console.WriteLine 或 Console.Out.Writeline 时,ir 打印到调用它的命令提示符而不是其他地方?

                  How do I make it so that when I say Console.WriteLine or Console.Out.Writeline ir prints to the command prompt from which it was called and not somewhere else?

                  我又一次知道如何做 Console.WriteLine 所以不是这样 :-p 除非我做错了.

                  Once again I know how to do Console.WriteLine so it's not that :-p unless I'm doing it wrong.

                  据我所知,这可能与 Console.SetOut(TextWriter t) 有关

                  From what I can tell it's probably something to do with Console.SetOut(TextWriter t)

                  这是一个 WPF 应用程序,我需要它将数据发布到命令行,同时在启动时仍保留 GUI.我已经三重检查并且我的代码命中了打印行,我实际上可以看到打印到 Visual Studio 输出窗口的行,当我在没有 VS 的情况下手动运行它时,它不会显示在命令行中.

                  this is a WPF application and I need it to post its data to the command line while still retaining the GUI at startup. I've triple checked and my code hits the print lines, I can actually see the lines being printed to the Visual Studio output window, it just won't display in the command line when I run it manually without VS.

                  如果可能,我需要有条件地显示控制台.即如果从命令行运行(甚至使用命令参数),显示或发布到提示符,否则不要.

                  If possible I need to conditionally have the console display. ie if run from command line (or even with command arguments), display or post to the prompt, otherwise do not.

                  推荐答案

                  将项目类型设置为控制台应用程序"而不是Windows 应用程序".这将导致应用程序附加到启动它的控制台(如果还没有控制台,则创建一个控制台).

                  Set the project type to "Console Application" instead of "Windows Application". This will cause the Application to attach to the console from which it was launched (or create a console if there was not one already).

                  这篇关于如何从 WPF 应用程序写入命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:DotNetFiddle 和 Console.ReadLine 出现问题,在按下 EN 下一篇:使用 AttachConsole,用户必须按 Enter 才能获得常规

                  相关文章

                  最新文章

                  <tfoot id='Di7co'></tfoot>

                  <legend id='Di7co'><style id='Di7co'><dir id='Di7co'><q id='Di7co'></q></dir></style></legend>

                  1. <small id='Di7co'></small><noframes id='Di7co'>

                  2. <i id='Di7co'><tr id='Di7co'><dt id='Di7co'><q id='Di7co'><span id='Di7co'><b id='Di7co'><form id='Di7co'><ins id='Di7co'></ins><ul id='Di7co'></ul><sub id='Di7co'></sub></form><legend id='Di7co'></legend><bdo id='Di7co'><pre id='Di7co'><center id='Di7co'></center></pre></bdo></b><th id='Di7co'></th></span></q></dt></tr></i><div id='Di7co'><tfoot id='Di7co'></tfoot><dl id='Di7co'><fieldset id='Di7co'></fieldset></dl></div>
                    • <bdo id='Di7co'></bdo><ul id='Di7co'></ul>