简体   繁体   English

具有参数并返回exitcode的自解压文件

[英]Self-extracting file that takes arguments and return exitcode

I want to create a self-extracting file (SFX) named Setup.exe which contains a Windows application with some dependencies. 我想创建一个名为Setup.exe的自解压文件(SFX),其中包含带有某些依赖项的Windows应用程序。

It is possible to start the Windows application with arguments, and I would like to put them at my Setup.exe and then it should pass them to the Windows application. 可以使用参数启动Windows应用程序,我想将它们放在我的Setup.exe中,然后它将它们传递给Windows应用程序。 Furtermore, I would like to pass the Windows application exit code to the Setup.exe. 此外,我想将Windows应用程序退出代码传递给Setup.exe。

Currently I have tried to use 7zip, but it seems that it isn't sufficient. 目前,我尝试使用7zip,但似乎还不够。

Is it even possible with 7z or do you know how to do with other tools? 7z甚至有可能还是您知道如何使用其他工具?

You've asked a lot of questions and I am trying to answer a few here, maybe not all of them. 您问了很多问题,我想在这里回答一些问题,也许不是全部。

Yes it is possible to start a Windows Application with arguments. 是的,可以使用参数启动Windows应用程序。 Ideally for that you need to open command prompt and navigate to the directory of your application then type in theProgramName.exe - arguments options but that I assume you already know. 理想情况下,您需要打开命令提示符并导航到应用程序的目录,然后键入theProgramName.exe - arguments options但我想您已经知道了。

Another approach would be to Create ShortCut for the Program you are targeting and then you can just Right click -> Properties -> and append your arguments to the Target field. 另一种方法是为您要定位的程序Create ShortCut ,然后只需右键单击->属性->并将参数附加到Target字段即可。 Example : C:\\Games\\Counter-Strike\\hl.exe -steam -game cstrike -noforcemparms -noforcemaccel 示例: C:\\Games\\Counter-Strike\\hl.exe -steam -game cstrike -noforcemparms -noforcemaccel

Another approach that I assume you would want when you are creating a SFX is to create a .bat (batch) file with the contents being theProgramName.exe - arguments options and put it in the same directory as your program and set it to run as our main application when it extracts. 我假设在创建SFX时想要的另一种方法是创建一个.bat (批处理)文件,其内容为theProgramName.exe - arguments options ,并将其放置在与程序相同的目录中,并将其设置为提取时是我们的主要应用程序。 If you want the exe and not the bat you can use some bat to exe conversion tools, there are tons out there. 如果您想要exe而不是bat ,则可以使用一些bat到exe转换工具,那里有很多东西。

The best way I can think of is using programs like Advanced Installer . 我能想到的最好方法是使用Advanced Installer之类的程序 You can directly make an msi or a sfx and send a shortcut anywhere (more than one) and it could contain arguments you specify just like what I described in the second way. 您可以直接制作一个msisfx并在任何地方(多个)发送快捷方式,它可以包含您指定的参数,就像我在第二种方法中所描述的那样。

So yeah that other tool I'd vouch for that will do what I think you want to do is Advanced Installer. 是的,我为之提供的其他工具将执行我认为您想要做的事情,即Advanced Installer。

After some experiments, I changed the implementation so instead of using 7 zip to create a SFX I just embed all I need like *.msp and such as embedded resources in my Windows application. 经过一些实验后,我更改了实现方式,因此不再使用7 zip创建SFX,而是将我需要的所有内容(例如* .msp和诸如嵌入式资源)嵌入到Windows应用程序中。 On that way my arguments and return code worked out of the box. 这样,我的参数和返回代码即开即用。

I used this link to do actual implementation: https://www.telerik.com/blogs/how-to-merge-assemblies-into-wpf-application 我使用此链接进行实际的实现: https : //www.telerik.com/blogs/how-to-merge-assemblies-into-wpf-application

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

相关问题 在linux机器上创建一个自解压zip存档 - Creating a self-extracting zip archive on a linux box 如何在静默模式下提取 WinZip 自解压 exe - How to extract WinZip Self-Extracting exe in silent mode 自行安装Zip存档(解压缩后运行应用) - Self Installing Zip Archives ( run app after extracting ) 在 Windows 平台的 linux 上使用自动运行创建自解压存档 - Create self extracting archive with autorun on linux for windows platform 使用oracle自解压安装程序为ubuntu时,Java不可见 - Java not visible when using oracle self extracting installer for ubuntu 在Linux上安装nsis失败exitcode1 - install nsis on linux fails exitcode1 WiX ExitCode forceReboot导致无限重启 - WiX ExitCode forceReboot causes endless rebooting 如何在管理员模式下启动带有安装inf文件参数的命令提示符 - How to start a command prompt in admin mode with arguments to install inf file 在安装 Ubuntu 20.04 时检测文件系统需要很长时间 - Detecting File System in installation of Ubuntu 20.04 takes really long 在Moq中,是否有一种简单的方法可以使Setup()返回null,而不管所提供的所有参数如何? - In Moq, is there a simple way to make Setup() return null, regardless of all arguments supplied?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM