簡體   English   中英

自動關閉RegSvr32提示

[英]Automatically close RegSvr32 prompts

我有一個C#程序,該程序執行一些調用RegSvr32的批處理文件。 當它執行時,出現一些提示,如帶有“確定”按鈕的“成功完成某些事情”。 如何自動關閉它們(使用戶看不到它們)?

它是一個控制台應用程序。 我不想引用類似的窗體或庫來模仿按鍵。

屏幕截圖:
蝙蝠消息

您可以使用/ s標志靜默運行RegSvr32

 Dim Procinfo As New ProcessStartInfo(<<Batch File Path>>) With {.RedirectStandardOutput = True, .RedirectStandardError = True, .UseShellExecute = False, .WindowStyle = ProcessWindowStyle.Hidden, .CreateNoWindow = True}
 Dim Proc As Process = Process.Start(Procinfo)

使用屬性WindowStyleCreateNoWindow,您可以隱藏命令行窗口。 您也可以從Proc對象處理批處理執行狀態。

 Dim sOut As StreamReader = Proc.StandardOutput
 Dim sError As StreamReader = Proc.StandardError
 Dim Outputs As String = sOut.ReadToEnd
 Dim Errors As String = sError.ReadToEnd

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM