I'm trying to run regasm on several dlls in a batch routine. I'm using the following code to try to accomplish this task however it doesn't seem to be working to register the dlls. I was trying to redirect the console input and output to determine if the registration failed or passed.

Code:
FileInfo regasmExe = new FileInfo(winDirectory + @"\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe");

 if (!regasmExe.Exists)
    throw new FileNotFoundException("The regasm.exe doesn't exsit in " + regasmExe.Directory.FullName);

 ProcessStartInfo startInfo = new ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\Cmd.exe");
                startInfo.RedirectStandardInput = true;
                startInfo.RedirectStandardOutput = true;
                startInfo.CreateNoWindow = true;
                startInfo.UseShellExecute = false; 
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                startInfo.WorkingDirectory = regasmExe.DirectoryName;

                process = Process.Start(startInfo);

                foreach (Assembly file in assemblies)
                {
                    if (file.Exists == true && file.Register == true)
                    {
                        process.StandardInput.WriteLine(String.Format("{0} {1} {2}", "regasm.exe", file.Filename, @"\codebase"));
                        OnOutput(process.StandardOutput);
                    }
                }
If anyone has tried to accomplish this type of task before or has a tip that would be great.