简体   繁体   English

修改exe以使用命令行参数启动而不创建快捷方式

[英]Modify exe to launch with command line arguments without creating shortcut

I'm trying to use winapi methods to modify an exe. 我正在尝试使用winapi方法来修改exe。

I don't know how to do it by hand either so that would be a good start if someone can share that with me then i can try to programatically acheive it. 我不知道怎么用手工做,所以如果有人可以与我分享,那么这将是一个良好的开端然后我可以尝试以编程方式实现它。

Basically have this exe: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe". 基本上有这个exe:“C:\\ Program Files(x86)\\ Mozilla Firefox \\ firefox.exe”。 I copied and pasted it to: "C:\\Program Files (x86)\\Mozilla Firefox\\SecondFirefox.exe" 我复制并粘贴到:“C:\\ Program Files(x86)\\ Mozilla Firefox \\ SecondFirefox.exe”

I don't want to make it a shortcut because I get some weird separation issues on the taskbar. 我不想让它成为捷径,因为我在任务栏上遇到了一些奇怪的分离问题。

I want to make "SecondFirefox.exe" launch with default command line arguments of -P "Dev" -no-remote , is this possible? 我想使用-P "Dev" -no-remote默认命令行参数启动“SecondFirefox.exe”,这可能吗?

Thanks 谢谢

Making a copy of the executable seems like a poor idea. 制作可执行文件的副本似乎是一个糟糕的主意。 Why should you have two copies of the same thing. 你为什么要有两份相同的东西。

I'd make a launcher program. 我做了一个发射器程序。 A very simple program that did nothing more than launch the original executable using the modified command line. 一个非常简单的程序,除了使用修改的命令行启动原始可执行文件之外什么也没做。

This will not answer your question on how to do it but it should give you a clue about what is going on 这不会回答你关于如何做的问题,但它应该给你一个关于发生了什么的线索

Windows use what is called Application ID which is an attribute for windows , processes and shortcuts . Windows使用所谓的Application ID ,它是windowsprocessesshortcuts的属性。 Using this ID Windows is able to determine how taskbar buttons are associated with windows and applications and how the system decides whether an application needs two taskbar buttons for its different windows or whether multiple applications need to share a single taskbar button. 使用此ID Windows可以确定任务栏按钮与窗口和应用程序的关联方式,以及系统如何确定应用程序是否需要两个任务栏按钮用于其不同的窗口,或者多个应用程序是否需要共享一个任务栏按钮。

But these IDs can be customized by the applications which means that the application still can specify whether two windows share the same icon or not 但是这些IDs可以由应用程序自定义,这意味着应用程序仍然可以指定两个窗口是否共享相同的图标

I create a small executable then I duplicate it and start them together, the result is each one has its own icon. 我创建一个小的可执行文件,然后我复制它并一起启动它们,结果是每个都有自己的图标。

But this were not the case with firefox when I duplicate the executable 但是当我复制可执行文件时,这不是firefox的情况

It is likely that firefox is altering the Application IDs of all running instances to one application ID and that is why all firefox taskbar icons are combined. firefox可能正在将所有正在运行的实例的Application IDs更改为一个应用程序ID,这就是所有firefox任务栏图标组合在一起的原因。 with that being said even if you tried to build it on your own, it is not easy to do. 即使您试图自己构建它,即使这样说也不容易。

I don't know for sure because I don't want to read the source code but you can still check out if that is Right. 我不确定,因为我不想阅读源代码,但你仍然可以查看是否正确。

Check out this link for more information about taskbar API 有关任务栏API的更多信息,请查看此链接

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

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