如何在运行时使用操作系统包重命名可执行/二进制文件?

发布于 2025-01-15 03:00:01 字数 349 浏览 3 评论 0原文

实际上这是一个非常简单的问题(可能有一些棘手的实现)。我有一个在二进制文件中执行的命令行应用程序,并且具有更新功能,可以用最新的文件重命名旧文件。

如何在使用 os 包或其他替代方案的先前二进制文件运行时实现二进制文件重命名(例如 Windows 中的 exe)?

示例:
先前的二进制文件:version1.exe
最新的二进制文件:version2.exe
我希望 version1.exe 按名称“转换”为 version2.exe,而不在运行时创建任何临时文件等。

actually this is a pretty straightforward question (with possible tricky implementation maybe). I have a command-line application which executed within a binary file and has an update feature which rename the old file with the newest one.

How can I implement binary file renaming (let's say exe in Windows) during runtime of the prior binary using os package or other alternatives?

Example :
prior binary : version1.exe
latest binary : version2.exe
I want version1.exe "transform" into version2.exe by name, without creating any temporary file or such during runtime.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文