从调用进程获取命令行
Get command line from calling process
我们使用能够使用脚本完成不同任务的软件。
在一个脚本中,我想启动一个小帮助工具来输入一些额外的数据。所以我需要知道下图调用软件的命令行参数。
是否有可能从调用进程中获取这些信息,或者至少通过查找 "Image Name"?
将 Wapac 的评论中的 link 与 Simon Mourier 在 this 问题中的回答相结合解决了问题。
现在我有两个帮手类:
- CommandLineUtilities
- ParentProcessUtilities
在我的程序中我现在只需要调用:
Process process = Process.GetCurrentProcess();
Process parent = ParentProcessUtilities.GetParentProcess(process.Id);
String[] parameters = CommandLineUtilities.getCommandLinesParsed(parent);
我们使用能够使用脚本完成不同任务的软件。
在一个脚本中,我想启动一个小帮助工具来输入一些额外的数据。所以我需要知道下图调用软件的命令行参数。
是否有可能从调用进程中获取这些信息,或者至少通过查找 "Image Name"?
将 Wapac 的评论中的 link 与 Simon Mourier 在 this 问题中的回答相结合解决了问题。
现在我有两个帮手类:
- CommandLineUtilities
- ParentProcessUtilities
在我的程序中我现在只需要调用:
Process process = Process.GetCurrentProcess();
Process parent = ParentProcessUtilities.GetParentProcess(process.Id);
String[] parameters = CommandLineUtilities.getCommandLinesParsed(parent);