It doesn't take 5 minutes to download and try it out yourself.
The gnu sed did work:
sed -i.bak "s/HKCU/new/g" envmig.xml
The redirection is implicit with -i.bak. envmig.xml.bak is created in the same directory. Then envmig.xml.bak is copied over envmig.xml. The changes to envmig.xml appear to occur in place.
One line of sed code to replace the long batch file above. Command line arguments could be used for "old" and "new". Then the sed
code sed -i.bak "s/old/new/g" would not need to be changed each time.
Output:C:\batch>c:\bin\sed -i.bak "s/HKCU/new/g" envmig.xml
C:\batch>type envmig.xml | more
<migration urlid="
http://www.microsoft.com/migration/1.0/migxmlext/oobeupgrade">
<component type="System" context="User">
<displayName>oobeUpgrade</displayName>
<paths>
<path type="File">%WINDIR%\oobeUpgrade</path>
</paths>
<role role="Settings">
<rules>
<detects>
<detect>
<condition negation="Yes">MigXmlHelper.IsOSLaterThan("NT","6.0.0.0")
</condition>
</detect>
</detects>
<rules>
<detects>
<detect>
<condition negation="Yes">MigXmlHelper.DoesObjectExist("Registry",
"new\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders [My M
usic]")</condition>
</detect>
<detect>
Input:
C:\batch>type envmig.xml | more
<migration urlid="
http://www.microsoft.com/migration/1.0/migxmlext/oobeupgrade">
<component type="System" context="User">
<displayName>oobeUpgrade</displayName>
<paths>
<path type="File">%WINDIR%\oobeUpgrade</path>
</paths>
<role role="Settings">
<rules>
<detects>
<detect>
<condition negation="Yes">MigXmlHelper.IsOSLaterThan("NT","6.0.0.0")
</condition>
</detect>
</detects>
<rules>
<detects>
<detect>
<condition negation="Yes">MigXmlHelper.DoesObjectExist("Registry",
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders [My
Music]")</condition>
</detect>
<detect>
<condition negation="Yes">MigXmlHelper.IsSameStringContent