Thursday, August 22, 2013

Create batch file to run exe file


I want to run my .Net application in the client system. But I don’t know client have .NetFramework or not.  Without .NetFramework  my application will not start. To solve this problem we can use two different types. One is while creating the setup file we need to add the prerequisites,  Another one is creates a batch file and run the necessary installations.

The below Batch file will help you to run the entire exe file in your folder.  In the below example NewFolder have all my pre installation setups. Like My application (MyApp.msi) and SQLExpress2005.exe. So I want to run my entire prerequisite one by one. For that the below Batch file will help me to achieve this.


Install.bat file:
---------------------------------------------------------------------------------
ECHO Installation Started
START  /WAIT  c:\windows\system32\notepad.exe  
CD NewFolder
START  /WAIT  "\NewFolder\"  MyApp.msi
START  /WAIT  "\NewFolder\"  SQLExpress2005.exe
cd..
START  /WAIT  setup.exe

---------------------------------------------------------------------------------


Explain:

Run from the direct exe path:
START  /WAIT  c:\windows\system32\notepad.exe  

Run in the root folder: 
START  /WAIT  MyApp.msi

Run inside the folder:
CD   NewFolder
START  /WAIT  "\NewFolder\"  MyApp.msi

Go back to root folder:
CD..


No comments: