In a Setup project the executable files such as “.exe , .dll , .js , .vbs” are acceptable but there is no way to run a .bat file in a Custom Action.
The question is how to run the *.bat files during installation?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, after much searching and trial and error I have solved this. I’m not sure if this is the best way, but it works.
Here’s the scenario: I have an application I would like to deploy via a Visual Studio Setup project. In addition to my application files, I would like to create a subdirectory in the target directory that contains a batch (.bat) file. I would like this file to run at the end of the installation process.
Here’s what you do:
/c "[TARGETDIR]subdirectoryname\batchfile.bat"in the Arguments property, where subdirectoryname should be replaced by the name of your subdirectory (if you put the batch file in a subdirectory like I did… if you didn’t, the value should be/c "[TARGETDIR]batchfile.bat") and batchfile.bat should be the filename of your batch file.That’s it. The batch file will now be executed once the rest of the installation process is completed.
Here’s an example for the sake of clarity:
My batch file: blah.bat
My subdirectory: mydir
The value of the Arguments for my custom action targeting cmd.exe would then be
/c "[TARGETDIR]mydir\blah.bat"