Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Oct 7 '10 at 9:03

This question came from our site for professional and enthusiast programmers.

    
Same as [ 'lsof' equivalent for windows ](stackoverflow.com/questions/15708/lsof-equivalent-for-windows). –  Matthew Flaschen Oct 7 '10 at 5:38

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
can the downvoter(s) please explain? –  Ruel Oct 7 '10 at 5:50
1  
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 '10 at 5:57
    
Well I thought it was what he meant (processes). Thanks for the explanation though. –  Ruel Oct 7 '10 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 '10 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.260‌​0.2982_x-ww_ac3f9c03 7B0: File (RW-) C:\InstantRails-2.0-win\rails_apps\upload\log\development.log –  AMIT Oct 7 '10 at 6:50

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

share|improve this answer
    
"handle" is the tool to use –  a_horse_with_no_name Oct 7 '10 at 6:24
    
Thanks but using handle can i get all files that are open on windows?? –  AMIT Oct 7 '10 at 6:30
    
@AMIT: just type 'handle' at the command prompt. –  ars Oct 7 '10 at 6:32
    
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 '10 at 6:39
    
@AMIT: handle -c <handle id> -p <process id> –  ars Oct 7 '10 at 6:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.