识别命令行参数

发布于 2024-11-24 00:55:11 字数 671 浏览 0 评论 0原文

可能的重复:
Windows 程序:如何监听命令行参数?

我在 Windows XP 下工作。

我获得了一些第三方软件,这些软件在启动时会生成多个进程。我的任务是编写该软件的替代品,尽管我需要保留其中一个进程(一个“通信服务器”,用于向其他联网计算机上的相同“通信服务器”传递消息/从其他联网计算机上的相同“通信服务器”接收消息)。这个过程的一小部分是学习直接启动“通信服务器”。如果我只是在没有命令行参数的情况下启动它,它会立即死掉。我认为这需要一些论据。所以,我所有的问题都归结为......

对于任何任意过程,是否有可能看到它以什么参数开始?如果是这样,我该怎么做?

我尝试附加 Visual Studio 2010,但没有 .pdb,所以我什么也没得到。不幸的是,我不知道这个“通信服务器”是用什么语言编写的。所以,这确实是一个不太可能的事情。 (我不确定这样做是否能给我一种找到论据的方法,但我认为值得一试。)

谢谢, 戴夫(Dave

)抱歉标签选择不当。这是一个很难分类的问题...

Possible Duplicate:
Windows Program: How to snoop on command line arguments?

I am working under Windows XP.

I've been given some third-party software that spawns several processes when launched. I've been tasked with writing a replacement for this software, though I will need to keep one of its proceeses (a "communication server" that passes / receives messages to / from identical "communication servers" on other networked machines). One small part of this process is learning to start the "communication server" directly. If I just start it with no arguments from the command line, it immediately dies. I'm thinking it needs some arguments. So, all my question boils down to is...

Is it possible, for any arbitrary process, to see what arguments it was started with? If so, how may I do so?

I tried attaching Visual Studio 2010, but there's no .pdb, so I got nothing. Unfortunately, I do not know what language this "communication server" is written in. So, it was really a longshot. (I wasn't sure if doing so would give me a way to find the arguments anyway, but I thought it was worth a try.)

Thanks,
Dave

P.S. Sorry for the poor choice of tags. This is a tough one to categorize...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

穿透光 2024-12-01 00:55:11

Process Explorer 显示它们。右键单击列表中的进程,然后单击Properties... -> 图像 -> 命令行

它不是 100% 可靠,因为进程可以覆盖包含命令行的缓冲区,但通常它可以工作。

Process Explorer displays them. Right click on a process in the list, then Properties... -> Image -> Command line

It's not 100% reliable since the process can overwrite the buffer containing the command line, but usually it works.

偏闹i 2024-12-01 00:55:11

进程资源管理器将允许您查看给定运行的命令行参数过程 :)

Process explorer will allow you to see the command line arguments for a given running process :)

神也荒唐 2024-12-01 00:55:11

应用程序本身不需要 PDB。 Windows DLL 具有 PDB;在 CreateProcessShellExecute / CreateProcessAsUser 等变体上放置断点。

You don't need the PDB for the app itself. Windows DLLs have PDB's; put a breakpoint on CreateProcess and variants like ShellExecute / CreateProcessAsUser.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文