プログラミング

Windows 10 でファイルやフォルダを開いているプロセスを特定するには

Windowsでファイル名やフォルダ名を変更しようとしたりすると、

ファイルが別のプロセスで使用されているため、プロセスはファイルにアクセスできません。

PS C:\pg\rails> mv tool tooltmp
mv : ファイルが別のプロセスで使用されているため、プロセスはファイルにアクセスできません。
発生場所 行:1 文字:1
+ mv tool tooltmp
+ ~~~~~~~~~~~~~~~
+ CategoryInfo          : WriteError: (C:\pg\rails\tool:DirectoryInfo) [Move-Item], IOException
+ FullyQualifiedErrorId : MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand

って拒否されることがあります。

ファイルを開いているプロセスを特定して、それをtaskkillできればいいのですが…。

その方法はいくつかあるようです。

  • OPENFILES コマンドで探す

再起動が必要です。

PS C:\pg\rails> C:\Users\UESR\Desktop\Handle\handle64.exe rails

Nthandle v4.11 - Handle viewer
Copyright (C) 1997-2017 Mark Russinovich
Sysinternals - www.sysinternals.com

explorer.exe       pid: 6588   type: File          11BC: C:\pg\RAILS\devise\db\migrate
explorer.exe       pid: 6588   type: File          1390: C:\pg\RAILS
explorer.exe       pid: 6588   type: File          1578: C:\pg\RAILS
explorer.exe       pid: 6588   type: File          2804: C:\pg\RAILS\devise\db\migrate
explorer.exe       pid: 6588   type: File          2FD8: C:\pg\RAILS\devise\app\views\devise\registrations
explorer.exe       pid: 6588   type: File          2FE0: C:\pg\RAILS\devise\app\views\devise\registrations
powershell.exe     pid: 16252  type: File            4C: C:\pg\RAILS\dev___
powershell.exe     pid: 716    type: File            4C: C:\pg\RAILS\dev___
powershell.exe     pid: 8924   type: File            4C: C:\pg\RAILS\english
powershell.exe     pid: 16488  type: File            4C: C:\pg\RAILS\devise
powershell.exe     pid: 16608  type: File            4C: C:\pg\RAILS\devise
atom.exe           pid: 19220  type: File           884: C:\pg\RAILS\english
atom.exe           pid: 19220  type: File           AEC: C:\pg\RAILS\english
atom.exe           pid: 19228  type: File           6B8: C:\pg\RAILS\devise
atom.exe           pid: 19228  type: File           750: C:\pg\RAILS\devise
cmd.exe            pid: 16944  type: File            4C: C:\pg\RAILS\tool
ruby.exe           pid: 28104  type: File            4C: C:\pg\RAILS\tool
ruby.exe           pid: 11316  type: File           2BC: C:\pg\RAILS\tool\log\development.log
ruby.exe           pid: 11316  type: File           32C: C:\pg\RAILS\tool
handle64.exe       pid: 15084  type: File            4C: C:\pg\RAILS
PS C:\pg\rails>
  • マイクロソフトのソフトウェアを使う
    Process Monitor
    Process Explorer

ref:

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です