Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6890775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:19:30+00:00 2026-05-27T06:19:30+00:00

I have a problem here….. I have a List of ProcessStartInfo as List<ProcessStartInfo> I

  • 0

I have a problem here…..

I have a List of ProcessStartInfo as List<ProcessStartInfo>

I want to Start processes in Series i.e

if i starts first process then second process in the List should start only when the first process (Exits or Aborts)…

I tries it like …..

    private void startSeriesExecution()
    {
        List<string> programpath = new List<string>();
        programpath.Add(@"C:\Program Files\Internet Explorer\iexplore.exe");
        programpath.Add(@"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE");

        foreach (var VARIABLE in programpath)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo
                                             {
                                                 FileName = VARIABLE,
                                                 Arguments =
                                                     "www.google.com"
                                             };

            try
            {
                using (Process process=Process.Start(startInfo))
                {
                    if (process.WaitForExit(Int32.MaxValue))
                    {
                        continue;
                    }
                }
            }
            catch (Exception)
            {
                continue;
            }
        }
    }

I am running startSeriesExecution using a Custom Class for MultiThreading all the process execute at the same time….

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        // This function starts the Execution in different thread
        Start.Work(startSeriesExecution).OnComplete(onSeriesExecutionComplete).Run();
    }

Also one more thing i observed…

if 1 Process is already running… lets say IE is running already and now i executed startSeriesExecution() and in this start an already running process (IE)… then the whole for loop is executed… i.e all the process in the list are executed…

Have have now no idea ho to proceed….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:19:30+00:00Added an answer on May 27, 2026 at 6:19 am

    That code looks like it would work. The WaitForExit will pause that thread until it completes.

    Also if these processes output a lot of information then you will need to add

    process.ErrorDataReceived += new DataReceivedEventHandler(process_ErrorDataReceived);
    process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
    

    Which is a good idea regardless, otherwise the process could hang until the output and error fields are cleared, which might never happen.

    Adding the events to the process will keep them outputting and hence not clog it up so to speak.

    UPDATE:

    If you want to check if a process is already running you can do this by this: stackoverflow.com/a/51149/540339

    Then you would have to loop and wait using Thread.Sleep(xxxx) until that process closes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem here, i want to make a multiple toolbar which works
I have a problem here... After a button is pressed I want a loop
I have a problem here, i want the left hand side menu to slide
I have a problem identical to this problem here . I even want to
I have a problem here. I have three parameters which I want to check
I have a problem here and I cant get it to work... I want
I have a problem here. My Zend_Forms do not render in view script. Via
Using Rational ClearCase v. 7.0.1.1 with UCM, I have a problem here when using
I have an interesting problem here I've been trying to solve for the last
I have a bit of an architecture problem here. Say I have two tables,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.