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

  • Home
  • SEARCH
  • 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 3951200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:42:07+00:00 2026-05-20T01:42:07+00:00

I have opened five notepad.exe’s. Now I want to know all the process id’s

  • 0

I have opened five notepad.exe’s. Now I want to know all the process id’s associated with each notepad.exe.

I know I can retrieve list of notepad processes by:

Process[] processes = Process.GetProcessesByName(“notepad”);

But now I want string[] of process Id’s of those notepad instances using LINQ. How do I do that? I know i can create string[] and using foreach loop populate the string[] but I would like to know using LINQ.

  • 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-20T01:42:08+00:00Added an answer on May 20, 2026 at 1:42 am

    You can use:

    Process[] processes = Process.GetProcessesByName("notepad");
    string[] ids = processes.Select(p => p.Id.ToString()).ToArray();
    

    However, I question the need to put this into a string[] type. It might be better to just leave the Process.Id values as integers:

    Process[] processes = Process.GetProcessesByName("notepad");
    var ids = processes.Select(p => p.Id);
    foreach(int processId in ids)
    {
       // Do something with each processId
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an exe which I have opened with PE Explorer Disassembler. Now I
I can switch between windows with C-x o, but if I have opened multiple
If I have 10 tabs opened, I have to close each one using :q
I have several aspx pages that can be opened either normally (full screen in
I know this isn't strictly a programming question but y'all must have experienced this.
I have opened a website using WebBrowser. Now I would like to programmatically click
I have opened an HTML file using file_get_contents('http://www.example.com/file.html') and want to parse the line
How do I send a string to a process I have opened with the
How can I get post id from the url. For instance I have opened
I have a longish list of files opened in vim that looks like this:

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.