• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1331
  • Last Modified:

How to execute a .BAT file (batch script) during or automatically after a Visual Studio Created Install/Setup Program?

Hello everyone,

I have created an installation "Setup Wizard" using Visual Studio 2003 for my C++ application. I have created a .BAT batch script that basically runs some command prompt commands to create a new user and a password for that user.

Currently the Install program just places the .BAT file on the users desktop for them to run after installation. It doesn't automatically run it after or during the installation.

How can I make it so that it either executes the .BAT file during or after the installation of my C++ program?

Again please note I'm using the standard Visual Studio 2003 "Setup Wizard" to create an installation/setup program that installs my C++ program on the users PC.

Thanks in advance.
0
VirtueTech
Asked:
VirtueTech
2 Solutions
 
AlexFMCommented:
I have VS 2005, hopefully in VS 2003 this is the same.
In Solution Explorer select project item, clock "Properties" tab. Properties contain PostBuildEvent - specifies any commands to execute after the build ends.
0
 
VirtueTechAuthor Commented:
I checked and I don't see it. Looks like it might be VS 2005 only. Too bad...that would have been perfect.

Thanks for the reply.

Anyone else have an idea?
0
 
Eduard GherguCommented:
Hello!

You can perform the following steps in order to do what you want. The problem is that only .exe, .dll, .vbs and .js files are supported but not .bat ones.
1. Select the setup project name;
2. In the Solution Explorer toolbar you'll find some new buttons. Click on the Custom Actions Editor.
3. In the Custom Actions window select Install node of tree
4. Go to Action menu and select Add Custom Action
5. Select Application folder from the combobox labeled Look in
6. Add file
7. Select All files, the click Add File
8. Browse and select the desired file
9. Build your solution.

So, you have to create a .vbs file instead of your .bat one
0
 
lakshman_ceCommented:
>>Currently the Install program just places the .BAT file on the users desktop for them to run after installation. It doesn't automatically run it after or during the installation.

You can also select 'User's desktop' instead of Application folder in step 5.

You would be able to run the batch file itself during the installation if you choose the file type as 'All files'
0
 
VirtueTechAuthor Commented:
Thanks guys....going to give it a shot tonight
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now