2016-02-10 135 views
2

我们使用能够将脚本用于不同任务的软件。从调用进程获取命令行

在一个脚本中,我想启动一个辅助工具来输入一些额外的数据。因此,我需要知道下图中显示的调用软件的命令行参数。

TaskManager - Command line parameters

是否有可能从调用过程中得到这些,或者至少通过寻找“映像名称”,让他们?

+0

请问HTTP://计算器.com/questions/2633628/can-i-get-command-line-arguments-of-other-processes-from-net -c help? – Wapac

回答

0

结合Wapac的评论和Simon Mourier在this的回答中提供的问题解决了问题。

现在我有两个辅助类:

  1. CommandLineUtilities
  2. ParentProcessUtilities

在我的节目,我只需要现在就拨打:

Process process = Process.GetCurrentProcess(); 
Process parent = ParentProcessUtilities.GetParentProcess(process.Id); 
String[] parameters = CommandLineUtilities.getCommandLinesParsed(parent);