Locked C# get a path from exist window

  • Monday, March 05, 2012 12:59 PM
     
     

    Dear all, I have created an application, one of the function I have used "system.diagonistics.Process.start(...)" the result of the path I passed will open "An EXIST FOLDER", I need now to get the path for this FOLDER, which opened in window.

    thank you

All Replies

  • Monday, March 05, 2012 6:26 PM
     
     

    Hello ModyEng,

    Dear all, I have created an application, one of the function I have used "system.diagonistics.Process.start(...)" the result of the path I passed will open "An EXIST FOLDER", I need now to get the path for this FOLDER, which opened in window.

    thank you

    The Path class provides methods and properties to retrieve the path you are interested, see the following links for more information.

    http://www.dotnetperls.com/path

    http://msdn.microsoft.com/en-us/library/system.io.path.aspx

    Regards.


  • Tuesday, March 06, 2012 5:48 AM
     
     

    Dear Ms.Monica,

    First and foremost, thank you for your cooperation, I believe the way I introduced my query was unclear.

    I know this Class well, and I use it now, my issue is" Now my application needs to scan whether a specific folder is exist or not in the system, this folder belong to "Dropbox", so I have tried to create function to scan, then I used "Environment.SpecialFolder" to get in and scan whether "Dropbox.exe" exist or not, now I could Successfully to see the the "exe" and i use "System.Diagnostics.Process.Start" to open the dropbox folder on new window, Now, i need to create a folder inside "Dropbox" folder which opened in the window, useing "Directory.CreateDirectory". so what do i need how can i access the path for this window which opened like"c:/......"

    Please, if my query not clear I can clear more

    thank you again,  


    • Edited by Mody Smith Tuesday, March 06, 2012 5:50 AM
    •  
  • Thursday, March 08, 2012 7:44 AM
    Moderator
     
     Answered Has Code

    Hi ModyEng,

    Welcome to the MSDN forum.

    It seems that you want to get the path of a running process. If so, you can try the sample below.

            private void Form1_Load(object sender, EventArgs e)
            {
                Process proc = Process.Start("notepad");
                string fullPath = proc.MainModule.FileName;    
            }

    If I misunderstood you, please let me know.

    Have a nice day.


    Bob Shen [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, March 16, 2012 12:43 AM
     
     

    Dear Mr.Bob,

    thank you so much for your cooperation, I believe that solution what I do need

    thank you again and for Carmelo  as well