How do you put a directoryname in a variable

  • Thread starter Thread starter Mark Coutinho
  • Start date Start date
M

Mark Coutinho

This is the problem:
- some people have a program installed in E:\program files\example
- other people have that one installed in E:\program files\example234
- the program should be installed in the first one
- so the program should be uninstalled for the people of the second
group

The batch has to find out first whether there is a directory of that
name (in this case: E:\program files\example234).
If yes: run the installer of that program.
If no: do nothing

How can I let the batch read out whether that directory exists?

Thanks in advance!
 
The batch has to find out first whether there is a directory of that
name (in this case: E:\program files\example234).
If yes: run the installer of that program.
If no: do nothing

How can I let the batch read out whether that directory exists?

if exist "E:\program files\example234" do echo I'm here

Replace "Echo I'm here" with the installer program.

Ciao, Walter
 
This is the problem:
- some people have a program installed in E:\program files\example
- other people have that one installed in E:\program files\example234
- the program should be installed in the first one
- so the program should be uninstalled for the people of the second
group

The batch has to find out first whether there is a directory of that
name (in this case: E:\program files\example234).
If yes: run the installer of that program.
If no: do nothing

How can I let the batch read out whether that directory exists?

Have you tried
IF EXIST "E:\program files\example234" GOTO uninstall
 
If this program is installed by an MSI, it is possible for you to:
1. Locate the unique Product ID (it should be the same for all apps you care
about)
2. Open the MSI database to determine where that instance of the program was
installed

With #2, you can un-ambigously figure out whether the program was installed
with the expected name or not. If it isn't, you can run the MSI to do the
uninstall and re-install, all silently unattend. Of course, with #2 you can
also un-ambiguously figure out where the program is actually installed -- so
you don't need to hard-code any paths in your script.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
Thanks guys,

I'll give it a go!
 
Back
Top