Well, of course the only way you can do this is if you can specify where to install the application. For example, a program like K-Lite Codec Pack, a command line program, I use this:
CODE
ECHO -K-Lite Codec Pack 2.10 Full to %systemdrive%\
IF "%systemdrive%"=="C:" START /WAIT %systemdrive%\install\KLCODEC\KLCP210f.exe /verysilent /dir="C:\Program Files\K-Lite Codec Pack" /more switches
IF "%systemdrive%"=="D:" START /WAIT %systemdrive%\install\KLCODEC\KLCP210f.exe /verysilent /dir="D:\Program Files\K-Lite Codec Pack" /more switches
Or if your %systemdrive% is C, install on D or whereever.
For programs that use a script, like ATI Control Panel, make two .iss files, eg:
CODE
ECHO -ATI Control Panel to %systemdrive%\
IF "%systemdrive%"=="C:" START /WAIT %systemdrive%\install\ATICP\Setup.exe -s -f1"%systemdrive%\install\ATICP\setupc.iss"
IF "%systemdrive%"=="D:" START /WAIT %systemdrive%\install\ATICP\Setup.exe -s -f1"%systemdrive%\install\ATICP\setupd.iss"
In setupc.iss the install folder is set to C:\Program Files\ATI and setupd.iss D:\Progra.... respectively.
There are ways to do cetain things in .cmd/.bat files. For example, this will detect if a folder exists.. and if the folder did exist, would do whatever you tell it to, in this case, ECHO D:\Folder exists!
CODE
IF EXIST D:\Folder\con ECHO D:\Folder exists!
And in this example, using the free program
locate this code will find, and set a variable that is the drive letter that the file is on. Example, if the file is E:\Stuff\file.txt it would set a variable named EDRIVE to E.
CODE
TYPE NUL | LOCATE file.txt /N | CHOICE /N /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ > NUL
FOR %%D IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF ERRORLEVEL H%%D SET EDRIVE=%%D
Make sense? Probably a complex way to do things, and may not be what you need but just letting you know there are ways to do a LOT more things than people think are possible in .cmd/.bat files.