Link to home
Start Free TrialLog in
Avatar of Saggi
Saggi

asked on

MS DOS scirpt to install and uninstall the application

I have application installed in C:\Application which needs to be uninstalled and install the new Application which has the setup.exe in C:\Software\Setup.exe

I want script to unstall and  install in silent mode from a batch file?
Avatar of rupeshsaini
rupeshsaini

Make a bat file or open a text file and save as name.bat file.

U have to make two bat =batch file

-one to uninstall and another to install
-Shedule the Install Batch file after unistall file (ie. after the application uninstall)

In Uninstall Batch file write following: ( ie open a text file and write)
1.
 c:\Application\<app_uninstallfile Name>
 exit
2. save it as uninstall.bat (or whatever name u like)

In install Batch file write following: ( ie open a text file and write)
1.
 C:\Software\Setup.exe
 exit
2. save the text file as filename.bat

Now just u have to shedule the two batch file accordingly
For sheduling u can use Control Panel--> shedule task

Regards
RS
ASKER CERTIFIED SOLUTION
Avatar of Lotok
Lotok
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Saggi

ASKER

This is clinical services application which was developed by company.
I don't see any uninstall option in start up eitther.
Applcation was installed in C: Drive folder CS which have ClinicalService.exe with many other folders.
Iam not sure how to uninstall from command prompt.

I have new setup.exe which is in C:\Software\Setup.exe which needs to be installed after uninstalling the old version.
I tried C:\Software\Setup.exe /x it didn't work,  shows up a dialog to upgrade....

I have the install shield setup package where can I find the GUID details in setup.ism?
If it has been developed in-house can you ask your developers if the exe supports commandline?
It depends how the application has been packaged, not all exe packages will allow you to install/uninstall from commandline.

the /x command is for use with an MSI. an EXE wont have a GUID.

If it is install shield, then manually open the exe. While the diaglogue is open for installation check C:\temp\ and c:\program files\common files and c:\program files\install sheild*

If there is a wrapped MSI it will be in one of those locations. Then you can use what I said above.
If there is no MSI you need to look at documentation or ask the developer about commandline support as not all EXE files allow it.

Avatar of Saggi

ASKER

While installing the product I see the project.ism file In C:\Documents and Settings\Sagar\Local Settings\Temp\_is57 folder

Whil uninstall also it looks like GUID with folder name created in the same path C:\Documents and Settings\Sagar\Local Settings\Temp\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

These floders {GUID} (uninstall)and _is57(install) are for only temporary once install/uninstall compLtes these folders are deleted.

Now I tried for uninstall
C:\WINDOWS\system32>msiexec.exe /X <GUID> /qn it didn't work.
I also tried C:\WINDOWS\system32>msiexec.exe /X <GUID> without /qn options it showed a message box "Do you want to uninstall the product" when I click Yes is show a message box with
"THIS INSTALLATION PACKAGE COULD NOT BE OPENED. VERIFY THAT THE PACKAGE EXISTS AND THAT YOU CAN ACCESS IT......................."
you need to open the installer so the _is57 folder is created. You then need to copy out the contents to another directory. You can then cancel the installer.

So now you have a directory with required files you can create the command lines

INSTALL
msiexec.exe /i fullpath\msiname.msi /qn

UNINSTALL
C:\WINDOWS\system32>msiexec.exe /X <GUID> /qn

The uninstall using that guid will only work AFTER you have installed from that msi.

If you need to uninstall and old version by commandline before you do the install you need to find out if it has its own GUID from a previous msi, or find out if there is an uninstall utility. If neither exist you need to manually uninstall it.

The only way you could script the manual uninstall is find developer install notes, reverse engineer them. So a .BAT file deleting files and directories and unregistering DLLs could be made.
Avatar of Saggi

ASKER

Iam writing this script for the purpose that it will uninstall and install each time a new build/MSI created. This process will be automated from a tool.

Copying the MSI installer into a different directory may work for once but when next new build comes it will not work unless someone copies into a different directory again. This will not solve problem.

I have installed new build and then tried to uninstall from the cmd prompt as you said C:\WINDOWS\system32>msiexec.exe /X <GUID> /qn it didn't work.

 When I make some changes in the code and new MSI is builded then GUID also changes each build?
Avatar of Saggi

ASKER

Un install works I havenot used the braces {} earliar for the GUID.
Issue with the install.
The GUID is unique to the MSI. it wont change unless the MSI changes.

You only need to copy the MSI out of that directory once. Store it on a share somewhere and then the commandline for install can be

msiexec.exe /i "\\myshare\path\mymsi.msi" /qn

Once you have the MSI out of the exe wrapper there is no need to run the exe again. the only exception is old installshield EXE's and new ones where the developer is lazy and ties params direct to the EXE. In most instances this isnt the case.
Avatar of Saggi

ASKER

Can you explain little clearly I didn't understand if I copy the MSI and install then each time Iam installing from the same location and the same MSI, how it was linked/upated with new MSI(setup.exe) which was builded each time.
For every 2 days I get a new build setup.exe, how this was linked to the MSI which I have stored from the previous setup.exe?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Saggi

ASKER

So as I understand from you we cannot do silent install setup.exe from a command prompt.
some exe's support it as discussed in the first few posts, but not all. /s or /qn are the silent switches to try. If they dont work then you need the msi.
Avatar of Saggi

ASKER

I dont see exe support silent switches. I don't have access to get/create MSI from the company management.
I will close this question.
Avatar of Saggi

ASKER

In my case its not possible to get the solution.