如何重命名exe文件

发布于 2024-07-10 00:06:43 字数 495 浏览 6 评论 0原文

假设我有一个通用的垂直市场应用程序,我想将其打包为两个单独的程序 aaa.exe 和 bbb.exe。 有没有办法使用 Delphi 链接器创建与 DPR 名称不同的 EXE/DLL 文件?

我不能只重命名该文件,因为我收到此错误

    bbb.exe - Unable to to locate component
      This application has failed to start because aaa.exe was not found. 
      Re-installing the application may fix this problem.
 

现在一般来说,我可以重命名可执行文件,但不能重命名此文件。 感谢您的评论指出我在这方面的愚蠢。 有一个问题,显然不是一个正常的问题,甚至可能不一定与 Delphi 有关。

我正在使用 Delphi 7(如果在 2007/2009 年可能的话那就太棒了,因为我需要更多的素材来升级)

Say I've got a generic vertical market application and I want to package it as two separate programs aaa.exe and bbb.exe. Is there any way to use the Delphi linker to create an EXE/DLL file that doesn't have the same name as the DPR?

I can't just rename the file because I get this error

    bbb.exe - Unable to to locate component
      This application has failed to start because aaa.exe was not found. 
      Re-installing the application may fix this problem.
 

Now in general, I can rename an executable, but not this one. Thanks for the comments to point out my boneheadedness in this regard. There is a problem, just obviously not a normal one, maybe not even necessarily Delphi related.

I'm using Delphi 7 (if it is possible in 2007/2009 that would be awesome because I need more fodder for upgrade)

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

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

发布评论

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

评论(6

我还不会笑 2024-07-17 00:06:43

Delphi 2007 和 Delphi 2009 都使用 MSbuild。 您可以使用 MSbuild 中的构建后事件来执行几乎任何您想要的操作。 例如,您可以使用复制任务将 EXE 复制到新文件名中。

Delphi 2007 and Delphi 2009 both use MSbuild. You can use post-build events in MSbuild to do almost anything you want. You could, for example, use the Copy task to copy the EXE into a new filename.

家住魔仙堡 2024-07-17 00:06:43

除了克雷格的出色回答(已投票)之外,如果您不幸陷入 D7,克雷格所说的仍然适用,您只需要自己完成繁重的工作,即为自己创建一个构建脚本来构建应用程序,而不仅仅是从 IDE 进行编译,使用 dos 脚本或(甚至更好)powershell,这需要一些前期工作,但从长远来看会给您带来更大的灵活性。

In addition to Craig's excellent answer (up-voted) if you are unfortunately stuck in D7, what Craig says can still apply, you would just need to do the heavy lifting yourself, i.e. create yourself a build script for building your apps rather than just compiling from the IDE, use a dos script or (even better) powershell, its a bit of work up front, but gives you more flexibility in the long run.

入怼 2024-07-17 00:06:43

您可以自己使用 FinalBuilder 等构建管理器,甚至 MSBuild。 不过我仍然建议升级到 Delphi 2009。 2009 年还有许多其他令人惊叹的新增内容。

You could use a build manager like FinalBuilder or even MSBuild on your own. I'd still recommend upgrading to Delphi 2009 though. There are so many other fabulous additions to 2009.

┾廆蒐ゝ 2024-07-17 00:06:43

为什么编译后无法重命名文件? 我没有得到完整的 UNIX 参考。 我可以重命名我在机器上找到的每个可执行文件,嗯......几乎每个人,只要他们当前没有执行即可。

为什么你不能? 你没有告诉我们什么?

只需右键单击资源管理器中的文件,选择重命名,然后为其指定一个新名称。 这对你不起作用吗? 如果没有,请告诉我们原因,因为您有一些事情没有告诉我们您的情况。

Why can't you rename the file after compilation? I don't get the whole unix reference. I can rename every executable file I find on my machine, well... almost everyone, as long as they're not currently executing that is.

Why can't you? What is it that you're not telling us?

Simple right-click the file in explorer, select Rename, and give it a new name. Does that not work for you? If not, please do tell us why, because there is something you're not telling us about your situation.

他不在意 2024-07-17 00:06:43

不可以,您不能让编译器创建名称与项目名称不同的文件。

您可以将您的项目放入“项目组”中。 将批处理项目附加到该组,然后在该批处理项目中输入一条命令来重命名或复制文件。 当您选择“Compile All”或“Build All”时,您的主项目将被处理,如果编译成功,下一个项目也将被处理,并运行批处理文件。

或者,由于您只是说要将其打包为两个程序,因此只需将安装程序配置为在安装过程中使用不同的名称编写两个副本,而不是在构建环境中生成两个副本,然后分发两个副本文件的副本。

我不明白您关于编译后无法重命名文件的评论。 完全允许重命名 EXE 文件,只要当时未使用该文件即可。

No, you cannot make the compiler create a file with a name different from the project name.

You can put your project in a "project group." Append to the group a batch project, and in that batch project, put a command to rename or copy the file. When you choose "Compile All" or "Build All," your main project will be processed, and if it compiles successfully, the next project will be processed as well, running the batch file.

Or, since you only said you want to package it as two programs, simply configure your installer to write two copies during installation, using different names, rather than producing both copies in your build environment and then distributing two copies of the file.

I don't understand your comment about being unable rename the file after you compile it. Renaming an EXE file is completely allowed, as long as it's not in use at the time.

七堇年 2024-07-17 00:06:43

或者您可以让程序在运行时检查它自己的 exe 名称。 如果它不是 aaa.exe 或 bbb.exe,则将其自身复制到这两个名称中并终止(或启动它们!)

Or you could have the program examine it's own exe name when you run it. If it is not aaa.exe or bbb.exe then have it copy itself into those two names and terminate (or launch them!)

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