process-management

Check if a specific exe file is running

点点圈 提交于 2019-11-26 17:36:56
问题 I want to know how i can check a program in a specific location if it is running. For example there are two locations for test.exe in c:\loc1\test.exe and c:\loc2\test.exe. I only wanted to know if c:\loc1\test.exe is running and not all instances of test.exe. 回答1: bool isRunning = Process.GetProcessesByName("test") .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"c:\loc1")) != default(Process); 回答2: This is my improved function : private bool ProgramIsRunning(string FullPath) { string

Windows Equivalent of 'nice'

孤街醉人 提交于 2019-11-26 13:50:08
问题 Is there a Windows equivalent of the Unix command, nice ? I'm specifically looking for something I can use at the command line, and not the "Set Priority" menu from the task manager. My attempts at finding this on Google have been thwarted by those who can't come up with better adjectives. 回答1: If you want to set priority when launching a process you could use the built-in START command: START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME |

Tracking CPU and Memory usage per process

早过忘川 提交于 2019-11-26 07:54:52
问题 I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn\'t help me as it shows immediate usage only. Is there a way (on Windows) to track the history of CPU & Memory usage for some process. E.g. I will start tracking \"firefox\", and after an hour or so will see a graph of its CPU & memory usage during that hour. I\'m looking for either a ready-made tool or a programmatic way to achieve