Batch file to read all of file, search for part of a known string, then place the whole string line into a variable.
Posted on 2013-05-31
So i have a backup and restore batch file I am working on for backing up the settings registry entry for Putty. I want to have the restore function work in a way that is easy to use. So far, i have been able to get the settings to export using the regedit /e HKCU\Software\SimonTatham.
When the export runs it exports to a shared directory and tags the export with a date string so we know when the file was last backed up...
Now for the restore, the best way I have found, but can't make work is to generate a txt file of the file contents where the reg backup is, have the batch file search this file for a known string (PuttyBackup) and have the batch file, once it finds it, cache the full name as a varibale for use later with the import script.
Any ideas? All of this is going to be done from a Windows 7 computer