This article introduces how to get and list folders and files that are open by specific software or programs on Windows PCs. Here, we use the PowerShell command line and the extended program handle64.exe.
For example, you can output all files opened by text editors like Atom or VS Code, or Chrome browser, along with their Process IDs (PIDs).
Specific Example: Atom Text Editor
In my case, I wanted to get folders and files open in Atom text editor, so I’ll use Atom as an example below.
When you must restart Windows, you may not know what files or projects you had open in Atom. I always restart after closing from “File > Exit,” but even then, if it doesn’t restart properly, Atom may not restore all windows on the next startup. For example, you might have had 8 windows open, but only 3 were restored.
If you can know in advance which files and projects are open, in the worst case you’ll be aware of them and can open them manually.
Required Tool: handle64.exe
First, download handle64.exe.
Procedure
- Download handle64.exe and place it in an appropriate folder. Here, we’ll use the desktop as an example.
- Open PowerShell and execute the following command:
C:\Users\user\Desktop\Handle\handle64.exe -p atom.exe
This will display all files that Atom has open. However, there may be too much output. In that case, use the Select-String Pattern option or -Exclude option to suppress unnecessary output.
For example, to display only files in a specific folder, execute the command as follows:
C:\Users\user\Desktop\Handle\handle64.exe -p atom.exe | Select-String -Pattern "pg|vm|note"
This will display only files that match the specified pattern.
Use this method to keep track of open files and folders, and use it to help restore them manually.