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 5995571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:58:43+00:00 2026-05-22T23:58:43+00:00

I have a need to launch multiple browser instances / tabs in succession but

  • 0

I have a need to launch multiple browser instances / tabs in succession but using Process.Start(url) I am finding that not every URL is launched.

    for (int i = 0; i < n; i++)
    {
        var p = Process.Start("http://localhost/#" + i.ToString());
    }

For any value n > 1 I find that only the last URL is opened in the browser (I’m testing with IE as the default browser). If I add a Thread.Sleep(1000) after Process.Start then I see a variety of behavior: sometimes all n are created; sometimes a subset.

The following does work as expected, but assumes IE (would rather use the default browser) and launches n browser instances rather than n tabs:

    for (int i = 0; i < n; i++)
    {
        var p = Process.Start("iexplore.exe", "http://localhost/#" + i.ToString());
    }

I would prefer to get it working with the default browser behavior, but need it to be deterministic.

  • 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-22T23:58:44+00:00Added an answer on May 22, 2026 at 11:58 pm

    Ended up with the following, still not ideal (launches multiple browser windows), incorporating the command-line arg parsing solution Split string containing command-line parameters into string[] in C#

    const int n = 3;
    static void Main(string[] args)
    {
        for (int i = 0; i < n; i++)
        {
            var start = GetDefaultBrowserStartInfo("http");
            start.Arguments += string.Format(" http://localhost/#{0}", i);
    
            var p = Process.Start(start);
        }
    }
    
    static ProcessStartInfo GetDefaultBrowserStartInfo(string scheme)
    {
        string command = null;
        using (var key = Registry.ClassesRoot.OpenSubKey(string.Format(@"{0}\shell\open\command", scheme)))
        {
            command = (string)key.GetValue("");
        }
    
        string[] parsed = CommandLineToArgs(command);
        return new ProcessStartInfo
        {
            FileName = parsed[0],
            Arguments = string.Join(" ", parsed.Skip(1).ToArray()),
        };
    }
    
    [DllImport("shell32.dll", SetLastError = true)]
    static extern IntPtr CommandLineToArgvW(
        [MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, out int pNumArgs);
    
    static string[] CommandLineToArgs(string commandLine)
    {
        int argc;
        var argv = CommandLineToArgvW(commandLine, out argc);
        if (argv == IntPtr.Zero)
            throw new System.ComponentModel.Win32Exception();
        try
        {
            var args = new string[argc];
            for (var i = 0; i < args.Length; i++)
            {
                var p = Marshal.ReadIntPtr(argv, i * IntPtr.Size);
                args[i] = Marshal.PtrToStringUni(p);
            }
    
            return args;
        }
        finally
        {
            Marshal.FreeHGlobal(argv);
        }
    }
    

    }

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

Sidebar

Related Questions

I have a need to create a transactional process using an external API that
I have a long running process and I need it to launch another process
I have an application that processes file transfers. In some instances, I need to
I need to launch an external process that is to be controlled via messages
I'm using VB.Net to launch multiple command line window (same exe file) through Process.StartInfo.
I have a java GUI jar file that i need to launch at my
Under Linux, my C++ application is using fork() and execv() to launch multiple instances
I have an agent program that will launch multiple instance of the same executable.
I have need to return multiple results from a subquery and have been unable
I have need for a function pointer that takes two arguments and returns a

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.