process with different name on windows - windows

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.

Related

Action cannot be completed because another process is using the file

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)

How to display the main window of a process in another Windows session?

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

How to pass multiple associated files to a program?

I have written a Windows software and I have associated a file extension with this program. When I double click a data file then my program starts up and opens the file. So far it works. But when I select multiple files and then click "Open" in the context menu then multiple instances of my program are started, one instance for one file. I want Windows to open ALL files with a single instance of my program. Is this possible without implementing a one-instance-handler in my program?
Currently the MyFileType/shell/open/command in the registry looks like this:
"C:\Program Files\MyApp\MyApp.exe" "%1"
Maybe there is some special Token/Variable I have to use instead of the "%1" to get it working? On Linux I have to use %f for a single file and %F for a list of files. Is there something similar on Windows?
The simplest way is to associate your app with the default shell verb (e.g. “open,” or “play,”) for the file type, and implements a drop target that uses SHCreateShellItemArrayFromDataObject to get the selected files. Suggested reading: How the Shell Invokes Verbs
If you don't like to take over the default verb, you can add your verb to the file association's open with list.
Another method is to make your app a singleton and send the document's path to the first instance via inter-process communication methods such as DDE or RPC. This requires you to keep your main window responsive (for example, won't work if you are showing a dialog)
%* might be what you're looking for.

View environment variable of process on Windows

How do I view the environment variable of a Windows process? Looking for Windows equivalent for something like environ file in procfs on Unix.
Process Explorer or one of its friends should help.
Check out GetEnvironmentStrings.
As ziya suggests, you can use the SysInternal's Process Explorer or, for example, slighly more feature rich Process Hacker.
Even though it's really trivial, I'll describe how to find the environment variables used by a specific process in any of those two applications:
in the list of running processes, select the process you're interested in (in Process Hacker or Process Explorer 16.40 and newer, you can use the search box on the main toolbar)
open the process' Properties dialog (double-click, press Enter or click Properties in the contect menu)
open the Environment tab
Process Explorer is displaying all environment variables in a single list, but Process Hacker organizes them into three sections by their scope:
Process: environment variables specific to the current process (e.g. passed from the command line or defined during the process creation
User: environment variables defined for the user who owns the process
System: system-wide environment variables shared by all processes
Take a look at the _environ variable.
To get process environment, you must be able to obtain its context. And within the context, use getenv() to get specific variable.

Application started by user or another application?

This is a very general question:
I was wondering whether it is possible to find out whether an application (any kind of application no matter if it a delphi-application or java or whatever) was started by a user or by another application? And if it is possible and I see that an application was called by another one, can I find out what the "father" application is, that called the new programm?
Thnx in advance!
EDIT: Maybe it is too general - How can I see whether a Delphi application has a parent application with Delphi itself, e.g. one application was started by a service and I need to find that service?
Every single running application has a parent application, which launched it (except for root system process).
It is not possible to tell, whenever it is user who directly clicked on application to lauch it or not.
Example: take Explorer shell (not Internet Explorer).
You can double click on any application to launch it. The parent process will be explorer.exe.
You can right-click on any file and a bunch of context menu extenders will load. Some of them may launch external applications to, say, create a preview of video-file (I saw this, swear!). The parent process will be explorer.exe, but user didn't indended to lauch any application. He just wants to view file's properties. He didn't even know, that applications were lauched!
Example: take Total Commander or any other two-panel file managers, which supports plugins for archives.
You can double click on any
application to launch it. The parent
process will be totalcmd.exe.
You may enter archive file and copy
(extract) few files from it to your
Documents folders. Corresponding
plugin may handle extraction by
itself or run invisible process to
handle all work. All you see is
progress bar in Total Commander. But
there is a new proces and its parent
is totalcmd.exe again.
There are no differences between cases 1 and 2 in both examples.
BTW, the definition "started by user" is unclear. You even may say that nothing can happen without user's command. All those background processes in cases #2 were launched because user asked for it. Well, user didn't asked for lauch explicitly, but he asked for operation itself.
You don't mention if you want to do this programmatically or if you're looking for a tool to just show the information.
If you just want to view the information, you can use Process Monitor, part of SysInternals:
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
In the Tools menu, there is a 'Process Tree' view that shows you a tree with parent / child process relationships and as well as the owner of each process.
If you want even more detail about processes, look at Process Explorer:
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
if it started by the user from windows so the parent will be explorer.exe, otherwise the parent will be the application which run the process.
to check the parent of a process by using tool check Ander Miller reply.
Did you see this question?
I'm not sure that I see problem right now.

Resources