9

I would like to know which file is open in Windows from command line. In linux we have command lsof for that purpose. Is there any command in Windows like that?

1

2 Answers 2

-3

Are you referring to current running processes? That would be: tasklist

If you want to view running processes of the current user:

tasklist /FI "username eq user"

Change user and put the current username.

9
  • 1
    can the downvoter(s) please explain?
    – Ruel
    Oct 7, 2010 at 5:50
  • 7
    Not a downvoter, but your answer simply does not apply: the question quit clearly states a list of files is wanted, not processes.
    – user5028
    Oct 7, 2010 at 5:57
  • Well I thought it was what he meant (processes). Thanks for the explanation though.
    – Ruel
    Oct 7, 2010 at 6:45
  • Ruel do you have any idea how do i achive that how do i close a file that is runing under certain process for example
    – AMIT
    Oct 7, 2010 at 6:50
  • ruby.exe pid: 556 TIGOC\x0138466 744: File (RW-) C:\DOCUME~1\x0138466\LOCALS~1\Temp\CGI.556.1 748: File (RW-) C:\Documents and Settings\x0138466\Local Settings\Temp 74C: File (RW-) C:\DOCUME~1\x0138466\LOCALS~1\Temp\mongrel.556.0 760: File (RW-) C:\InstantRails-2.0-win\rails_apps\upload\log\development.log 784: File (RW-) C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03 7B0: File (RW-) C:\InstantRails-2.0-win\rails_apps\upload\log\development.log
    – AMIT
    Oct 7, 2010 at 6:50
23

If you want a command line tool, the Handle utility from SysInternals does this. For a GUI tool, check out Process Monitor.

6
  • and one more thing i would like to know is it possible to close a file Running under a specific process using handle ,i don't want to close the process but a file that is opened .
    – AMIT
    Oct 7, 2010 at 6:39
  • 1
    @AMIT: handle -c <handle id> -p <process id>
    – ars
    Oct 7, 2010 at 6:57
  • ruby.exe pid: 556 TIGOC\x0138466 744: File (RW-) C:\DOCUME~1\x0138466\LOCALS~1\Temp\CGI.556.1 748: File (RW-) C:\Documents and Settings\x0138466\Local Settings\Temp 74C: File (RW-) C:\DOCUME~1\x0138466\LOCALS~1\Temp\mongrel.556.0 760: File (RW-) C:\InstantRails-2.0-win\rails_apps\upload\log\development.log 784: File (RW-) C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03 7B0: File (RW-) C:\InstantRails-2.0-win\rails_apps\upload\log\development.log
    – AMIT
    Oct 7, 2010 at 7:03
  • ars ruby.exe is process running with pid 556 ,from there i have to delete file with number 7444 how do i do that without closing ruby.exe with id 556
    – AMIT
    Oct 7, 2010 at 7:05
  • handle -p 556 -c 744
    – AMIT
    Oct 7, 2010 at 7:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .