How do I check the path of any random file which opens accidently using uipath?

How do I check the path of any random file which opens accidently using uipath?

Can you elaborate?

No file opens accidentally I hope until we open the file in the code :slight_smile:

Actually I need to write a code to fetch the path of current location. Suppose I end up opening any file or folder then I need it’s path via writing uipath code.

You can get that using many predefined classes :slight_smile: @Chandni,

  1. system.Windows.Forms.Application.ExecutablePath
  2. Environment.CurrentDirectory this will work as I used it earlier

We have many

Step 1 is to figure out which process you want. Is it the active window? Or will you be able to dynamically fetch the name of the process?

Once you get the process, you can determine the full file path using System.Diagnostics.Process.MainModule.FileName - see more info here ProcessModule.FileName Property (System.Diagnostics) | Microsoft Learn