Close safely File Exlorer for specific window

yo people,

As part of my process I have to navigate to specific path in File Explorer to open application (can’t be opend through cmd). In the end of the process (or if system error occurs) I would like to close that specific window before starting over.
Do you guys know about safe way how to close File Explorer for specific window (file)?

I tried activity Close Application but that shuts down entire Explorer.exe (very not desired).

As for know I am using Attach Window + Send HotKey (alt + F4).

Do you see issue with this approach?
Does anyone have better way of doing such a task?

Have a good day :wink:

@vendetta

Welcome to the UIPath Community.

As you said you are using Attach window activity right and for this create one window variable as output.

And then pass window variable into Close Window activity to close that particular window. By doing this way, it will close that particular window instead of closing all windows.

@lakshman

Thank you for the welcome :slight_smile:

I tried your approach but it still kills the explorer.exe instead of the particular window.
Adding code: test.xaml (5.1 KB)

The Attach Window + Send HotKey (alt + F4) actually closes only the attached window and so far was working good. The reason I am asking my question is that I think alt + F4 is a bit overkill for such a task.