cmd progress bar not redirecting

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am using DISM to mount an image but its not redirecting the progress bar it makes.

When using dism normally is goes...

Mounting WIM.
[======================99%================]
Finished mounting.

When i use the code below i receive the "Mounting WIM." but then it pauses for a while and then "Finished mounting" appears, it completely skips the progress part.
Anyone know how to make it show the progress bar or at least the percentage.

Thanks. :)


<pre>{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "DISM.exe";
p.StartInfo.Arguments = "/Mount-Wim /Wimfile:" + """ + "D:\Win7SP1\sources\boot.wim" + """ + " /index:1 /MountDir:" + """ + "C:\W7T\Mount" + """;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardError = true;
p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(OnDataReceived);
p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(OnDataReceived);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();



}

public void OnDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{

if (e.Data != null)
{
MessageBox.Show(e.Data);
}
}[/code]

<br/>

View the full article
 
Back
Top