I have a simple C# console app that receives and argument with an ID for exec other task and wait for it.
I want to know the ID passed to C# console app with WMIC but it's empty.
The WMIC command is:
WMIC path win32_process where "caption='process_name.exe'" get Commandline
The C# console app was executed in CMD with:
process_name.exe 1
I want to capture the 1 or ID
Like @willaien says: Catch the args with string[] args = Environment.GetCommandLineArgs();
solved the issue.