Link to home
Start Free TrialLog in
Avatar of PerseExchange
PerseExchange

asked on

How to substitute a %variable% for a drive letter or UNC name.

I am trying to copy my Office 2003 setup from the server to a DVD that can be sent out to users to self install Office. My officepro.ini file has an entry that points to

[ChainedInstall_1]
PATH=\\server\share\Apps\Microsoft\Office\MSOffice_2003\FILES\Add-Ons\MSOffice.2007\FileFormatConverters.exe
TASKTYPE=exe
CMDLINE=/quiet

[ChainedInstall_2]
PATH=\\server\share\Apps\Microsoft\Office\MSOffice_2003\FILES\SVCPACK\ohotfix.exe
TASKTYPE=exe

What I want to do for these type entries that point to the \\server\share UNC name, is change it so that they point to a variable so it would not matter what the drive letter of the DVD is. I know the variable is surrounded by % sihns, I just do not know what to put in between for the variable. Any help on this would be appreciated.
Avatar of Perkentha1
Perkentha1

%cdrom% is the default variable for the systems first cd drive letter.

If this is not what you are looking for please elaborate.
Another Quick thing you can do is this.

@echo off
ECHO Try to found the CDROM-DRIVE
SET CDROM=A
IF EXIST D:\CDROM_IP.5 SET CDROM=D:
IF EXIST E:\CDROM_IP.5 SET CDROM=E:
IF EXIST F:\CDROM_IP.5 SET CDROM=F:
IF EXIST G:\CDROM_IP.5 SET CDROM=G:
IF EXIST H:\CDROM_IP.5 SET CDROM=H:
IF EXIST I:\CDROM_IP.5 SET CDROM=I:
IF EXIST J:\CDROM_IP.5 SET CDROM=J:
IF EXIST K:\CDROM_IP.5 SET CDROM=K:
IF EXIST L:\CDROM_IP.5 SET CDROM=L:
IF EXIST M:\CDROM_IP.5 SET CDROM=M:
IF EXIST N:\CDROM_IP.5 SET CDROM=N:
IF EXIST O:\CDROM_IP.5 SET CDROM=O:
IF EXIST P:\CDROM_IP.5 SET CDROM=P:
IF EXIST Q:\CDROM_IP.5 SET CDROM=Q:
IF EXIST R:\CDROM_IP.5 SET CDROM=R:
IF EXIST S:\CDROM_IP.5 SET CDROM=S:
IF EXIST T:\CDROM_IP.5 SET CDROM=T:
IF EXIST U:\CDROM_IP.5 SET CDROM=U:
IF EXIST V:\CDROM_IP.5 SET CDROM=V:
IF EXIST W:\CDROM_IP.5 SET CDROM=W:
IF EXIST X:\CDROM_IP.5 SET CDROM=X:
IF EXIST Y:\CDROM_IP.5 SET CDROM=Y:
IF EXIST Z:\CDROM_IP.5 SET CDROM=Z:
if %CDROM%==A GOTO :CD_ERR
ECHO Your CDROM-DRIVE is: %CDROM%



Sorry meant to add this to previous post
in the above you would want to subsititute cdrom_ip.5 for a folder or file on the root of the DVD in question.  This just checks all drive letter for that information,  once it finds it, it creates the %CDROM% variable.
ASKER CERTIFIED SOLUTION
Avatar of matrixnz
matrixnz

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 PerseExchange

ASKER

matrixnz, thanks a million man. This helped out greatly, and is working like a champ.