简体   繁体   English

获取一个exe的所有可能的命令行参数的列表

[英]Get list of all possible command line arguments for an exe

Is there anyway for me to get the list of available command line arguments for an exe? 无论如何,我有没有获取exe可用命令行参数的列表? I need to create a Powershell script that start the Relius Agent Manager program, but this program requires database login and password info to load. 我需要创建一个Powershell脚本来启动Relius Agent Manager程序,但是该程序需要数据库登录名和密码信息才能加载。

I can obtain the login/pass info, but I need to know the names of the argument I'll need to pass them through. 我可以获得登录/传递信息,但是我需要知道传递它们的参数名称。

It doesn't matter if I use Powershell or C# to retrieve the list of arguments, I just need to know their darn names. 我使用Powershell还是C#检索参数列表都没有关系,我只需要知道它们的织名即可。

I read up on the Process class in C# but I don't see anything that will actually list the available arguments, only how to list what was passed when a process was started. 我阅读了C#中的Process类,但是没有看到任何实际列出可用参数的内容,仅列出了启动过程时所传递的内容。

There is no way to query the supported command line arguments. 无法查询支持的命令行参数。 Try running the program from a command prompt with no arguments, with an invalid argument, with /h, /?, -h, --help and similar arguments to see if one of these prompts the program to output a list of allowed arguments. 尝试从不带参数,带无效参数,带有/ h,/?,-h,-help和类似参数的命令提示符下运行程序,以查看其中是否有一个提示程序输出允许的参数列表。

search for universal silent switch finder. 搜索通用静音开关查找器。 it is actually possible to do programmatically but requires deep diving into binary executable. 实际上可以通过编程来完成,但是需要深入研究二进制可执行文件。 if interested check http://code.google.com/p/pefile/wiki/PEiDSignatures 如果有兴趣,请检查http://code.google.com/p/pefile/wiki/PEiDSignatures

Thanks for all of your help. 感谢您所有的帮助。 I was able to solve it by having someone start it manually and then log in, and then I checked this list of all running processes with this command: 我可以通过有人手动启动然后登录来解决它,然后使用此命令检查了所有正在运行的进程的列表:

"WMIC /OUTPUT:C:\\ProcessList.txt PROCESS get Caption,Commandline,Processid" “ WMIC /OUTPUT:C:\\ProcessList.txt过程获取标题,命令行,Processid”

I was then able to find exactly what was passed when it was run from the file that command generated and execute that command in PowerShell using something like: 然后,我可以从命令生成的文件中准确找到运行该文件时传递的内容,并使用以下命令在PowerShell中执行该命令:

$exp = "&'C:\\path\\to\\the\\exe.exe' /param1 /param2 /param3" invoke-expression $exp $ exp =“&'C:\\ path \\ to \\ the \\ exe.exe'/ param1 / param2 / param3” invoke-expression $ exp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM