Evolver Posted March 30, 2007 Share Posted March 30, 2007 (edited) Who has never had problems with some.ini configuration files, .iss install descriptions or .reg registry addons, containing absolute directories?I have...And I do hate having absolute directories on my Install-CD/DVD C:\Program Files\... Because with these, you're limited to installing on the C-drive only...I like to keep the possiblity to do installations on other partitions as wel...So I looked for a solution... B) And found one OK, let me start by saying that I found it, I didn't create it...' Subject: Perform Search and Replace on a file' Author: Brad Thurber - brad.thurber--AT--home.com' Credit: Mostly a cut-and-paste from other helpful people' Date: Sept 13, 1999' Version: 0.11So I don't deserve credit for this program, but I altered it a little for easier and silent use. I know how scripts work, I can read them, I can change them, but I still can't make my own...I just have something with putting pieces together, I guess.It's just a little .vbs script.But it works like magic...Replace.rarHow to use:Replace.vbs can now simply be called from a batch-file with:Replace.vbs <FILENAME> <FINDSTRING> <REPLACESTRING>Example:The Freeware-program 'FileRecovery' ( http://www.pcinspector.de/file_recovery/nl/welcome.htm )can be installed with setup.exe -s -a -s -f1"/<directory>/setup.iss"setup.iss can be obtained by installing 'Filerecovery with setup.exe -RMy testsystem is on de G-drive, this is how my setup.iss looked like:[InstallShield Silent]Version=v7.00File=Response File[File Transfer]OverwrittenReadOnly=NoToAll[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-DlgOrder]Dlg0={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdWelcome-0Count=6Dlg1={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdLicense-0Dlg2={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdRegisterUser-0Dlg3={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdAskDestPath-0Dlg4={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdStartCopy-0Dlg5={0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdFinish-0[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdWelcome-0]Result=1[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdLicense-0]Result=1[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdRegisterUser-0]szName=FileInspectorszCompany=-My Company-Result=1[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdAskDestPath-0]szDir=G:\Program Files\PC Inspector File RecoveryResult=1[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdStartCopy-0]Result=1[Application]Name=PC Inspector File RecoveryVersion=4.0Company=Convar Deutschland GmbHLang=0009[{0DD140D3-9563-481E-AA75-BA457CBDAEF2}-SdFinish-0]Result=1bOpt1=0bOpt2=0Now the problem with this, is the line:szDir=G:\Program Files\PC Inspector File RecoveryInstallations on C, D, E just won't work with this line...More specific, G:\Program Files can be a big problem.In batch-files, just replacing this with %ProgramFiles% will do, but the same solution doesn't work with most configuration-files.There's no simple way to change it to make it usable on all partition-installs.Now with Replace.vbs, there is a solution...Replace.vbs can make the right changes to make it work...However, these changes can't happen on a CD, the file needs to be copied to Hardisk first.So, this is how it can be done:1. Copy the file to be changed to %temp%2. Use Replace.vbs on the file in %temp% to make the changes3. Use the file in %temp% for the installationExample: (I called this one Prepare.cmd)cd /d %0\..@echo offcmdow @ /HID@echo offcopy /y setup.iss "%temp%\setup.iss"Replace.vbs "%temp%\setup.iss" "G:\Program Files" "%ProgramFiles%" EXITThis works like a charm...First it copies setup.iss tot %temp%,then all G:\Program Files will be changed to %ProgramFiles%The real magic about this is, that %ProgramFiles% won't be written to the file...No, no, no,... the real (absolute) path will be written to it!!!!How much better can it be?Then to finnish the installation, all there's left to do is point the installer (still on the CD) to setup.iss in the %temp%-directory.Like this:pci_filerecovery.exe -s -a -s -f1"%temp%\setup.iss"Enjoy... Edited March 30, 2007 by Evolver Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now