如何在 Visual 安装程序中打包 BAT 以及如何在 MSI 安装期间运行 BAT 文件? [英] How to package a BAT in Visual installer and how to run a BAT file during MSI installation?

查看:45
本文介绍了如何在 Visual 安装程序中打包 BAT 以及如何在 MSI 安装期间运行 BAT 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含此内容的 BAT 文件:

I have a BAT file with this content:

"XYNTService.exe" "-i"

我目前正在使用 Visual Studio 安装程序构建安装包.我在 Application Folder 中添加了这个 BAT 文件.现在我想在安装过程中执行它.怎么办?

I am currently building up an installation package using Visual Studio Installer. I added this BAT file inside the Application Folder. Now I want to execute it during installation process. How can it be done?

我已经浏览了很多关于自定义操作的信息,但仍然不明白如何去做.需要帮助.

I have surf a lot about custom actions, but still fail to understand how to do it. Need help.

谢谢.

推荐答案

最终,您始终可以通过使用相关参数对 cmd.exe 执行 ShellExecute 或 CreateProcess 来运行批处理文件.

Ultimately, you can always run a batch file by doing ShellExecute or CreateProcess on cmd.exe with the relevant parameters.

但是,请记住 MSI 自定义操作在与安装用户不同的用户上下文中运行.您可能很难让批处理文件执行您想要的操作.

However, rememeber that MSI custom actions run in a different user context from the user who is installing. You may struggle to get the batch file to do what you want to.

马丁

这篇关于如何在 Visual 安装程序中打包 BAT 以及如何在 MSI 安装期间运行 BAT 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆