3

We use a software which is capable of using scripts for different tasks.

In one script I want to start a little helper tool to input some additional data. Therefore I need to know the command line parameters of the calling software shown in the picture below.

TaskManager - Command line parameters

Is there a possibility to get these from the calling process or at least to get them by looking for the "Image Name"?

daengl
  • 241
  • 3
  • 15
  • Would http://stackoverflow.com/questions/2633628/can-i-get-command-line-arguments-of-other-processes-from-net-c help? – Wapac Feb 10 '16 at 07:44

1 Answers1

0

Combining the link from Wapac's comment with the Simon Mourier's answer in this question solved the problem.

Now I have two helper classes:

  1. CommandLineUtilities
  2. ParentProcessUtilities

In my program I just need to call now:

Process process = Process.GetCurrentProcess();
Process parent = ParentProcessUtilities.GetParentProcess(process.Id);
String[] parameters = CommandLineUtilities.getCommandLinesParsed(parent);
Community
  • 1
  • 1
daengl
  • 241
  • 3
  • 15