Ok, so I’m not super familiar with using For /F. I can modify it if the file is static and has a set ammount of lines that i can skip and then pull data from. I’m currently trying to modify an .XML file. The file will have varying ammounts of lines, but will always have the following
</SyncWindow>
</AutoSyncWindows>
<SyncServiceConnections />
<DaysToRetainRecordedData>90</DaysToRetainRecordedData>
<SyncRestartRequired>false</SyncRestartRequired>
- <LastGroupsSynced>
The value for <DaysToRetainRecordedData>90</DaysToRetainRecordedData> may differ, for example <DaysToRetainRecordedData>30</DaysToRetainRecordedData>
Using tokens, what would be the most efficient way to search that .XML file for that line and overwrite it with the following <DaysToRetainRecordedData>0</DaysToRetainRecordedData>
I can not overwrite the entire .XML file as they have unique server keys that will vary from machine to machine.So I need to be able to find that line and edit the value to 0.
Any thoughts? If For /F is not the most efficient way to go, I can move to VBS if need be. But it would have to be called from pure shellcode and would make things a bit more complex.
The most elegant, flexible and safe way to do this would be to download msxsl.exe and then use a tiny XSLT stylesheet to modify only the value you want in the XML:
Call that on the command line with:
The command line parameter
newValuewill show up in the XSL program.