Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get Process Command Line, Parent Process ID & Username in C#, When you pass pid or process name.

Thanks for replying.

NO WMI PLEASE.

I already have: VB .NET ( YAPM ), AutoIt (NTQuery..(), zswQuer...()), C++ with MFC/COM ( NTPROCESSINFO.h ).

I tried to convert vb .net to c# but the project is big & conversion doesn't complete only & also i had extracted the code for cmdline but there is only arithmetic overflow exception.

I don't want EnumerateProcess/Service(), I want getProcessCmdLine(pid) function in C#.

Similarly for others.

If anybody has already created the class or methods only, please share.
Posted
Updated 23-Oct-12 20:25pm
v3
Comments
sameeruvw 24-Oct-12 2:26am    
Thanks for replying.

NO WMI PLEASE.

I already have: VB .NET ( YAPM ), AutoIt (NTQuery..(), zswQuer...()), C++ with MFC/COM ( NTPROCESSINFO.h ).

I tried to convert vb .net to c# but the project is big & conversion doesn't complete only & also i had extracted the code for cmdline but there is only arithmetic overflow exception.

I don't want EnumerateProcess/Service(), I want getProcessCmdLine(pid) function in C#.

Similarly for others.

If anybody has already created the class or methods only, please share.

Use the Win32_Process WMI class[^]. Here is a good tutorial about how you can do this in c#: How To: (Almost) Everything In WMI via C# Part 2: Processes[^]
 
Share this answer
 
Comments
sameeruvw 24-Oct-12 2:26am    
Thanks for replying.

NO WMI PLEASE.

I already have: VB .NET ( YAPM ), AutoIt (NTQuery..(), zswQuer...()), C++ with MFC/COM ( NTPROCESSINFO.h ).

I tried to convert vb .net to c# but the project is big & conversion doesn't complete only & also i had extracted the code for cmdline but there is only arithmetic overflow exception.

I don't want EnumerateProcess/Service(), I want getProcessCmdLine(pid) function in C#.

Similarly for others.

If anybody has already created the class or methods only, please share.
Zoltán Zörgő 24-Oct-12 5:02am    
Sorry, I have no resources to follow your strange wishes.
sameeruvw 17-Nov-12 5:20am    
Thanks but i got c# cmdline, parent pid & username in c#
sameeruvw 17-Nov-12 5:20am    
Solved
You may find this piece of documentation interesting: Process Class at MSDN[^].
 
Share this answer
 
Comments
sameeruvw 24-Oct-12 2:26am    
Thanks for replying.

NO WMI PLEASE.

I already have: VB .NET ( YAPM ), AutoIt (NTQuery..(), zswQuer...()), C++ with MFC/COM ( NTPROCESSINFO.h ).

I tried to convert vb .net to c# but the project is big & conversion doesn't complete only & also i had extracted the code for cmdline but there is only arithmetic overflow exception.

I don't want EnumerateProcess/Service(), I want getProcessCmdLine(pid) function in C#.

Similarly for others.

If anybody has already created the class or methods only, please share.
Solved

I Have c# cmdline, parent process id, username
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900