Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve results of regsvr32 execution from command line (without message boxes/popups)
    text
    copied!<p>C# WinForms application (.NET 4)</p> <p>Directory path is selected from a combo(dropdown) menu and it is then included in the following command line statement.</p> <pre><code>for %f in ("&lt; path &gt;\*.ocx" "&lt; path &gt;\*.dll") do regsvr32 /s "%f" </code></pre> <p>where <strong>&lt; path ></strong> is the directory path.</p> <p>This executes fine. I would like to retrieve the registration successful messages (or errors) without the user having to click OK a thousand times to the popup / message box that displays. Obviously the silent (/s) switch gets rid of the popups.</p> <p>What would be the best way to retrieve the results without the user seeing anything on their screen (besides the application itself)?</p> <p>This is what I have right now,</p> <pre><code>public void reg_in_source_2() { ProcessStartInfo cmdStartInfo = new ProcessStartInfo(); cmdStartInfo.FileName = @"C:\Windows\System32\cmd.exe"; cmdStartInfo.RedirectStandardOutput = true; cmdStartInfo.RedirectStandardError = true; cmdStartInfo.RedirectStandardInput = true; cmdStartInfo.UseShellExecute = false; cmdStartInfo.CreateNoWindow = true; Process cmdProcess = new Process(); cmdProcess.StartInfo = cmdStartInfo; cmdProcess.ErrorDataReceived += cmd_Error; cmdProcess.OutputDataReceived += cmd_DataReceived; cmdProcess.EnableRaisingEvents = true; cmdProcess.Start(); cmdProcess.BeginOutputReadLine(); cmdProcess.BeginErrorReadLine(); cmdProcess.StandardInput.WriteLine(@"for %%f in (""" + reference.source_folder + @"\*.ocx"" " + reference.source_folder + @"\*.dll"") do regsvr32 ""%%f"""); cmdProcess.StandardInput.WriteLine("exit"); cmdProcess.WaitForExit(); } public void cmd_DataReceived(object sender, DataReceivedEventArgs e) { reference.cmd_replies.Add(e.Data); } public void cmd_Error(object sender, DataReceivedEventArgs e) { reference.cmd_replies_errors.Add(e.Data); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload