Not sure whether I have the message above exactly correct but I run into this often. I try to use Windows to delete a directory or a file and it tells me I can't because the file is in use by another program. It doesn't say what process is using it.
Sometimes it is clear what is using it, but other times it is not. I open the Task manager and go through all the processes but nothing stands out.
Is there a way to determine what has a file open, and a solution (other than rebooting)?
I suppose most of the time it may be Eclipse related but certainly not all of the time.
I use Process Explorer
Ever wondered which program has a particular file or directory open?
Now you can find out. Process Explorer shows you information about
which handles and DLLs processes have opened or loaded.
You can add the column like shown below (Window Title) and it should help you find the file you are looking for, and what is using it:
If you end up choosing to use this program instead of Task Manager, there is an option for that which will open this instead of Task Manager:
If you decide to "Replace Task Manager" and ever get stuck where you cannot 'undo' what you've done (Meaning, "The original Task Manager will no longer open")... You can modify the registry listed here and delete the Debugger entry. (In this example, I have this path to a network drive).
I had this problem in Excel, where some files would be active, but not visible to me, either on my screen or in the task manager. The way I solved it was to use the command prompt to kill the task:
Open command prompt (type cmd in windows search at the bottom left of your screen)
Type "tasklist"
Find the task you want to terminate (for me it was EXCEL.EXE)
End the task by either using the image name (type "taskkill /im EXCEL.EXE", or whatever program you want to end. This will kill all tasks with that image name) or using the ID (i.e. "taskill /pid 1234, or whatever ID the program has. This will kill that specific task)
Related
When a Windows batch file is launched via a shortcut (from the Start Menu, for example), its window will typically receive the title of the shortcut.
Is it possible for the batch file to determine the name of its own window?
This question is related to Can a Windows batch file determine its own file name?, but that question asks if the batch file can determine its own filename. I am asking if a batch file can determine its own window name.
StackOverflow user QcFe lent a kind hand by finding this QA on Superuser: https://superuser.com/questions/1155853/how-to-get-the-window-title-text-from-batch-file
The short answer is that Windows provides no simple and direct way for batch files to accomplish this task.
Windows provides the internal title command to set the window title, but no way to retrieve it. (Which is disappointing, because it would be such a simple addition to the title command.)
The functionality can be attained using PowerShell or possibly tasklist, but for the latter, there are issues that need to be addressed if there are more than one command shell window open.
I elected to force the window to have a unique name using the Title command. That way I could reference it correctly for tools that need to know the window title, such as NirSoft's excellent nircmd utility.
I have been trying to figure out how to programmatically identify the process that has a lock on a particular file. I've searched through the Win32 API and WMI, but so far I can't find anything. I know it's possible - Sysinternals is able to list every resource accessed/locked by every process on the system.
Can anyone drop me a hint?
You can use handle.exe from Sysinternals.
Something like:
> handle /accepteula C:\path\to\directory
...
program.exe pid: 1234 type: File 2E4: C:\path\to\directory
...
Thanks to https://stackoverflow.com/a/599268/367916 .
You could use Process Explorer from Microsoft
Download & unpack & run Process Explorer
Click Find menu and then click Find Handle or DLL... or press CTRL + F
Copy and paste path to locked folder of file
Click Search, you can kill process from main Process Explorer window
If you can limit yourself to new enough versions of Windows, the Restart Manager can tell you which process has a particular file open.
Because of the way Process Explorer works, I suspect that what you need to look for is a way of finding the file handles attached to a given process, and that you'll have to pull that list for each process in the system and look for your file within it.
I don't know in Windows, but somebody might find useful to know that, in Linux, you can use the lsof command, or just search through the folders /proc/PROCESS_ID/fd and see what process has opened the file.
WhoLockMe is a nice right click windows explorer extension.
This article might be helpful to you.
It appears you are forced to search through the list of files for each process on the system using undocumented functions in ntdll.dll.
When running a Scheduled Task under Windows to launched batch processes under a dedicated account, you could want to see output of theses processes.
These sub-processes could be either or both graphical or character based applications
As there are running in a different Windows Logon session, I cannot find way to display their output. There are like ghost processes
I would expect being able to use the show Window command from Process Explorer, but even via running Process Explorer under the dedicated account used to run the task (via runas), it is not working
Is there a way to do it ?
References : http://www.brianbondy.com/blog/id/100/
I believe that once created, a window cannot be transferred to another window station. Also, I doubt it is possible to open windows in another session. For character-based applications you are better off writing the output to some file and examining that file. For graphical applications you are out of luck with task scheduler. You may want to write a simple VBS script that wakes up at a certain time and runs your graphical task(s) and run it upon user logon, e.g. along the lines of a script from this page:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/d9465815-87e2-43df-a0fe-4a23c16dca99/need-a-time-schedule-in-vbs-script-to-execute-something
I have a process on windows, lets call it DDD.exe .
That process runs several times parallel. I open the task manager. I would like to change the name of the process that runs that it will contained also a number.
For instance: DDD1.exe , DDD2.exe etc' .
Can I do that ?
Thanks
If all you want is to differentiate between the instances, it's already there, in the process's PID column.
That field is the file name of the executable. The only way to change it is to make copies of the executable with different names. I don't imagine you want to do that.
I personally use Process Explorer as my task manager. When you hover over an entry in Process explorer, a hint window is displayed containing the command line passed to the process. You could make use of this feature if you passed a benign ID parameter when you created each process.
I'm using codeblocks to as my IDE for C++ and every 10mins or so I get the following
error message:
"Reload File? File c:...node.cpp is modified outside the IDE. Do you want to reload
it? (you will lose andy unsaved work)" Yes/No/All/Cancel
If I click yes by mistake sometimes I lose the last couple of minutes of work. If I
click no then everything remains ok.
So I downloaded "Process Monitor" to find out what program was accessing my cpp file
and it tells me that SVCHost may be the culprit.
As far as I'm aware SVCHost is responsible for all sorts of things. Does anyone have any idea what I can do to stop receiving this error message?
N.B. This error message didn't appear for the first month or so that I used codeblocks,
but I have no idea what I've done that might have caused the problem.
[Screenshot][http://i44.tinypic.com/sgk3sx.jpg]
I came across the same problem and I resolved it by removing a tick in front of "check for externally modified files" in
Settings -> Environment -> General settings
You're right in that svchost is a generic process name that is used by a multitude of different services. I think the reason was to prevent a lot of processes for every tiny little service that might want to do something - a group of them will share a single svchost process.
Process Explorer from Sysinternals can be used to figure out what services are being performed by a specific svchost process by finding the process ID (1296 in your JPEG file) and double-clicking on the entry.
Then, in the properties dialog that appears, choose the services tab and it will show you the particular services using that process.
If you don't want to (or can't) install Process Explorer, you can use the command-line:
tasklist /svc /fi "imagename eg svchost.exe"
to get a list of all the services in each process.