Replace test in a file

Status
Not open for further replies.

kevin79

Ars Scholae Palatinae
1,197
Ok, not completely sure if this is considered programming, if not please move to the correct location.

I have a batch script that installs a program by calling the installer and using a XML file for settings. The XML file doesn't support variables and there are a couple locations that I want to set so that it is local for the users. I'll give an example below.

Is there a way to read a variable in the batch file and replace text in the XML with the result of the variable?

Example:
  • In the batch file:
    • set SOFT_ROOT=c:\Software
    • call %SOFT_ROOT%\Install.exe %SOFT_ROOT%\Options.xml
  • In the XML file:
    • <sourceDir> value="X:\\App\\Location" />
The location of %SOFT_ROOT% will be different on each computer.
X: isn't mapped for everyone and it also ins't local for all users. Instead I want to have it point to "C:\\Software".

Is there a way to do this?
 
Status
Not open for further replies.