久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <i id='r9xkl'><tr id='r9xkl'><dt id='r9xkl'><q id='r9xkl'><span id='r9xkl'><b id='r9xkl'><form id='r9xkl'><ins id='r9xkl'></ins><ul id='r9xkl'></ul><sub id='r9xkl'></sub></form><legend id='r9xkl'></legend><bdo id='r9xkl'><pre id='r9xkl'><center id='r9xkl'></center></pre></bdo></b><th id='r9xkl'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='r9xkl'><tfoot id='r9xkl'></tfoot><dl id='r9xkl'><fieldset id='r9xkl'></fieldset></dl></div>
        <bdo id='r9xkl'></bdo><ul id='r9xkl'></ul>
      <legend id='r9xkl'><style id='r9xkl'><dir id='r9xkl'><q id='r9xkl'></q></dir></style></legend>
    1. <small id='r9xkl'></small><noframes id='r9xkl'>

    2. <tfoot id='r9xkl'></tfoot>

      如何直接在 C# 中執行批處理命令?

      How I can execute a Batch Command in C# directly?(如何直接在 C# 中執行批處理命令?)
        <bdo id='1M38B'></bdo><ul id='1M38B'></ul>
            <tbody id='1M38B'></tbody>
        • <i id='1M38B'><tr id='1M38B'><dt id='1M38B'><q id='1M38B'><span id='1M38B'><b id='1M38B'><form id='1M38B'><ins id='1M38B'></ins><ul id='1M38B'></ul><sub id='1M38B'></sub></form><legend id='1M38B'></legend><bdo id='1M38B'><pre id='1M38B'><center id='1M38B'></center></pre></bdo></b><th id='1M38B'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1M38B'><tfoot id='1M38B'></tfoot><dl id='1M38B'><fieldset id='1M38B'></fieldset></dl></div>
        • <tfoot id='1M38B'></tfoot>

          <legend id='1M38B'><style id='1M38B'><dir id='1M38B'><q id='1M38B'></q></dir></style></legend>

            <small id='1M38B'></small><noframes id='1M38B'>

              • 本文介紹了如何直接在 C# 中執行批處理命令?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我想執行一個批處理命令并將輸出保存在一個字符串中,但是我只能執行該文件并且無法將內容保存在一個字符串中.

                I want to execute a batch command and save the output in a string, but I can only execute the file and am not able to save the content in a string.

                批處理文件:

                @echo 關閉

                "C:lmxendutil.exe" -licstatxml -host serv005 -port6200>C:TempHW_Lic_XML.xml 記事本 C:TempHW_Lic_XML.xml

                "C:lmxendutil.exe" -licstatxml -host serv005 -port 6200>C:TempHW_Lic_XML.xml notepad C:TempHW_Lic_XML.xml

                C#代碼:

                private void btnShowLicstate_Click(object sender, EventArgs e)
                {
                     string command = "'C:\lmxendutil.exe' -licstatxml -host lwserv005 -port 6200";
                
                     txtOutput.Text = ExecuteCommand(command);
                }
                
                static string ExecuteCommand(string command)
                {
                     int exitCode;
                     ProcessStartInfo processInfo;
                     Process process;
                
                     processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
                     processInfo.CreateNoWindow = true;
                     processInfo.UseShellExecute = false;
                     // *** Redirect the output ***
                     processInfo.RedirectStandardError = true;
                     processInfo.RedirectStandardOutput = true;
                
                     process = Process.Start(processInfo);
                     process.WaitForExit();
                
                     // *** Read the streams ***
                     string output = process.StandardOutput.ReadToEnd();
                     string error = process.StandardError.ReadToEnd();
                
                     exitCode = process.ExitCode;
                
                     process.Close();
                
                     return output; 
                }
                

                我想要一個字符串的輸出,并直接在 C# 中執行此操作而無需批處理文件,這可能嗎?

                I want the output in a string and do this directly in C# without a batch file, is this possible?

                推薦答案

                不需要使用CMD.exe"來執行命令行應用程序或檢索輸出,您可以直接使用lmxendutil.exe".

                Don't need to use "CMD.exe" for execute a commandline application or retreive the output, you can use "lmxendutil.exe" directly.

                試試這個:

                processInfo = new ProcessStartInfo();
                processInfo.FileName  = "C:\lmxendutil.exe";
                processInfo.Arguments = "-licstatxml -host serv005 -port 6200";
                //etc...
                

                進行修改以在此處使用命令".

                Do your modifications to use "command" there.

                我希望這會有所幫助.

                這篇關于如何直接在 C# 中執行批處理命令?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                onClick event for Image in Unity(Unity中圖像的onClick事件)
                Running Total C#(運行總 C#)
                Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                Calling A Button OnClick from a function(從函數調用按鈕 OnClick)
                  <bdo id='UZSDq'></bdo><ul id='UZSDq'></ul>
                      <tbody id='UZSDq'></tbody>
                    <tfoot id='UZSDq'></tfoot>
                      1. <small id='UZSDq'></small><noframes id='UZSDq'>

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

                      2. <legend id='UZSDq'><style id='UZSDq'><dir id='UZSDq'><q id='UZSDq'></q></dir></style></legend>
                        • 主站蜘蛛池模板: 欧美一区二区三区视频 | 91资源在线 | 黄色一级电影免费观看 | 日韩精品一区二区三区在线观看 | 农村真人裸体丰满少妇毛片 | 国产91在线精品 | 污污免费网站 | 亚洲欧美中文字幕 | 久久久久国产 | 精品一区二区三区四区 | 国产精品自拍av | 国产精品美女久久久久久不卡 | 欧美一级片在线看 | 九色综合网 | 福利一区在线观看 | а_天堂中文最新版地址 | 人人做人人澡人人爽欧美 | 欧美成人高清视频 | 久久久久久国产精品免费免费 | 中文字幕在线精品 | 日韩电影在线 | 亚洲三区视频 | 午夜精品久久久久99蜜 | 国产欧美在线 | 欧美区在线 | 欧美成人第一页 | 欧美日韩成人一区二区 | 日韩电影一区 | 在线中文字幕亚洲 | 国产精品18久久久久久白浆动漫 | 亚洲欧美日韩在线不卡 | 国产精品久久久久久久久久 | 大香网伊人 | 午夜小电影 | 精品国产乱码久久久久久中文 | 国产一区二区三区四区在线观看 | 国产精品美女www爽爽爽视频 | 黄网站免费观看 | 在线视频一区二区三区 | 日产久久 | 亚洲伊人久久综合 |