Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Use visual Studio to compile an XML file including a changing variable

$
0
0

I am nearing completion on a little project of mine. I am writing a program in visual studio to help me activate windows 7. All I need is a way to inject a product key (This will depend on the key typed into TextBox1) into an XML file. I have posted the XML file here. Specifically an unattend.xml file. And I would like to replace "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" with the key I type into TextBox1. If there is not a way to do this. Is it possible to maybe write a code to compile a new XML file for each time I use it. I am using Visual Basicfor the actual code. Or am I fighting a lost cause? Thanks in advance

<?xml version="1.0" encoding="UTF-8"?>

-<unattend xmlns="urn:schemas-microsoft-com:unattend">


-<settings pass="generalize">


-<component language="neutral" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" name="Microsoft-Windows-PnpSysprep"><PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>


-<UserData>


-<ProductKey><WillShowUI>OnError</WillShowUI><key>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</key></ProductKey><AcceptEula>false</AcceptEula></UserData></component></settings>


-<settings pass="specialize">


-<component language="neutral" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" name="Microsoft-Windows-Shell-Setup"><CopyProfile>true</CopyProfile></component></settings>


-<settings pass="oobeSystem">


-<component language="neutral" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" name="Microsoft-Windows-Shell-Setup">


-<FirstLogonCommands>


-<SynchronousCommand wcm:action="add"><Order>1</Order><CommandLine>Bcdedit -timeout 5</CommandLine></SynchronousCommand></FirstLogonCommands></component>


-<component language="neutral" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" name="Microsoft-Windows-Deployment">


-<Reseal><Mode>OOBE</Mode></Reseal></component></settings>


-<settings pass="auditUser">


-<component language="neutral" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" name="Microsoft-Windows-Deployment">


-<RunSynchronous>


-<RunSynchronousCommand><Order>1</Order><Path>%SystemDrive%\rpktools\copy_unattend.bat</Path><WillReboot>OnRequest</WillReboot></RunSynchronousCommand>


-<RunSynchronousCommand><Order>2</Order><Path>%SystemDrive%\rpktools\createtask.bat</Path><WillReboot>OnRequest</WillReboot></RunSynchronousCommand></RunSynchronous>


-<RunAsynchronous>


-<RunAsynchronousCommand><Order>1</Order><Description>Run device manager in Audit mode</Description><Path>%SYSTEMDRIVE%\DevMgr.bat</Path></RunAsynchronousCommand></RunAsynchronous></component></settings><cpi:offlineImage xmlns:cpi="urn:schemas-microsoft-com:cpi" cpi:source="wim://rpk2/distribution/images/new_win7home_64.wim#'Windows'"/></unattend>


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>