{"id":22188868,"url":"https://github.com/qwreey/fps","last_synced_at":"2025-07-26T20:32:11.974Z","repository":{"id":177808776,"uuid":"658407051","full_name":"qwreey/fps","owner":"qwreey","description":"Which process using folder or file?","archived":false,"fork":false,"pushed_at":"2023-07-01T21:22:54.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-30T19:58:52.646Z","etag":null,"topics":["powertoys","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qwreey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-25T16:45:04.000Z","updated_at":"2023-10-28T06:28:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2252aaf-28e6-456f-b3db-d330764c38e0","html_url":"https://github.com/qwreey/fps","commit_stats":null,"previous_names":["qwreey75/fps","qwreey/fps"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwreey%2Ffps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwreey%2Ffps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwreey%2Ffps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwreey%2Ffps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qwreey","download_url":"https://codeload.github.com/qwreey/fps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227715591,"owners_count":17808733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powertoys","windows"],"created_at":"2024-12-02T11:12:58.347Z","updated_at":"2024-12-02T11:12:59.114Z","avatar_url":"https://github.com/qwreey.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fps: File locking ProcesseS (CLI version of Powertoys FileLocksmith)\r\nWhich process using folder or file?\r\n\r\nIn windows, when you move file, delete file or eject disk, probably, you can see error messgae 'File Is Open in Another Program' which very annoying.\r\nFps was designed for this situation, you can automate taskkill, and automate safe eject. like\r\n\r\n```bat\r\n@echo off\r\n@rem the fps.exe file should be next to bat\r\n\r\n@rem get bat's disk\r\nset \"HERE=%~dp0.\"\r\nset DISK=%HERE:~0,3%\r\n\r\n@rem get pid of this script selfs (for exclude)\r\ntitle diskkill\r\nfor /f \"tokens=2 delims=,\" %%a in ('tasklist /v /fo csv ^| findstr /i \"diskkill\"') do set \"mypid=%%~a\"\r\n\r\n@rem kill all of tasks which running on disk\r\nset TRY=0\r\n:KILL\r\nset /a \"c=%TRY%+1\"\r\nset ARGS=\r\nfor /F \"tokens=*\" %%B in ('%HERE%\\fps.exe -f pid -H') do call :AddArgs %%B\r\nif DEFINED ARGS if \"x%TRY%\" != \"x5\" ( taskkill /T%ARGS% \u0026 goto :KILL )\r\n\r\n@rem Eject target disk\r\npowershell -NoProfile \"$disk = (New-Object -ComObject Shell.Application).Namespace(17).ParseName('%DISK%'); $disk.InvokeVerb('Eject'); do { Sleep 1 } until ($disk.Type.Equals('Removable Disk') )\"\r\n\r\nexit 0\r\n:AddArgs\r\nif \"x%1\" == \"x%mypid%\" exit /b 0\r\nset \"ARGS=%ARGS% /PID %1\"\r\nexit /b 0\r\n```\r\n\r\nOr, you can create simple embedable script like lua too.\r\n\r\n# Uses\r\n\r\n```\r\nUsage:   fps [-HA] [-f pid,image,...] ...[\u003cFile|Directory\u003e]\r\nDefualt: fps -f \"pid,image,user\" .\r\n\r\nReport processes which using specific file or directory.\r\nIf filter option not given, prints pid, name and user as default.\r\nThe output order of each element follows the order of the given options.\r\nOptions can be combined into a single argument like 'fps -HA'\r\nexample: fps -f \"pid,image\" .\r\n\r\nGeneral options\r\n -h, --help, -?  Show this messages.\r\n -H, --headless  Print results without heading.\r\n -a, --all       Use all filter options, output order follows the order of help.\r\n -f, --filter [filter,filter,...]\r\n                 Use filters to show. see 'Filter options'\r\n -v, --version   Show version of fps\r\n -V, --verbose   Verbose mode for debugging (Not used for now)\r\n -c  --count     Count number of processes and print it as last line\r\n\r\nFilter options\r\n pid    PID of found process.\r\n image  Image name of found process.\r\n        This is the executable file name rather than the full path.\r\n user   Username of who the found process runs.\r\n path   Full path of found process\r\n files  Full paths of files which found process uses.\r\n\r\nExit status:\r\n 0: if found processes\r\n 1: if has no processes\r\n 2: commandline arguments is invalid\r\n```\r\n\r\n# Build\r\n\r\nOpen sln with visual studio, and build. You should install C++ 20, Windows SDK 10.0.19041.0 or up.\r\n\r\n# Todo\r\n\r\nAdd selector like --select \"image\" \"equal\" \"...\"\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwreey%2Ffps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqwreey%2Ffps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwreey%2Ffps/lists"}