i'm kind of stuck here. so for my final project i want to change our procedure for configuring new customers systems. To be precise - start a batch that does "everything" for you. First you have to name some things that will be needed later something like:
:NameNAMESPACE
echo Whats the Namespace?
set /p NAMESPACE=Name Namespace:
echo Is %NAMESPACE% correct? (Y)es / (N)o
set /P p=Please choose:
if /i "%wahl%"=="Y" goto:CreateFolder
if /i "%wahl%"=="N" goto:NameNAMESPACE
echo Wrong choise!
goto:NameNAMESPACE
:NameHOSTNAME
echo Whats the Hostname?
set /p HOSTNAME=Name Hostname:
echo Ist %HOSTNAME% correct? (Y)es / (N)o
set /P wahl=Please choose:
if /i "%wahl%"=="Y" goto:CreateFolder
if /i "%wahl%"=="N" goto:NameHOSTNAME
echo Wrong choise!
goto:NameHOSTNAME
I thing you get it :)
The problem is, at some point i need to edit an *.xml file (could be an text file at first, but must be saved as xml)
In this file
looks like this
<?xml version="1.0" encoding="utf-8" ?>
<root>
<!--Connection-->
<add name="V4H_CONNECTIONINFO" value="Server=HOSTNAME;ServicePort=IISPort;ConnectionPort=1972;Namespace=NAMESPACE;ServiceUser=LicenseSlot_0;ServicePassword=!cgm!;Customer=SYS"/>
<!--URLs-->
<add name="V4H_URL_CLICKONCE" value="http://HOSTNAME:8010/v4h.Downloader.application"/>
<add name="V4H_URL_CHANNEL" value="http://HOSTNAME:IISPort"/>
<add name="V4H_URL_SERVICES" value="http://HOSTNAME:IISPort/Services/ChannelServices.asmx"/>
<add name="V4H_URL_SILVERLIGHT" value="http://HOSTNAME:IISPort/?ConnectionInfo={0}"/>
<!--ASP.NET-->
<add name="V4H_DBCONNECTION_CHANNEL" value="HOSTNAME,1972,NAMESPACE,ChannelServices_{12:0-5},!cgm!,Pooling=false"/>
<add name="V4H_DEBUGMODE_CHANNEL" value="false"/>
</root>
the parameters set earlier must be changed (hostname,namespace and port) and the saved as hostname_namespace.xml
I already tried to get some these to work from here click
or here click
i managed to get this to work but only to change one parameter
@echo off &setlocal
set NAMESPACE=TEST_CH_L
set "search=NAMESPACE"
set "replace=%NAMESPACE%"
set "textfile=test.txt"
set "newfile=Output.txt"
(for /f "delims=" %%i in (%textfile%) do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
echo(!line!
endlocal
))>"%newfile%"
del %textfile%
rename %newfile% %textfile%
echo Done
pause
So i hope one of you can help me and sorry for the loooog post
thanks in advance Max