cmd - how to remove a few lines from a Unicode registry file using batch commands in Windows? -


i have program who's generating data in registry. save "reg export hkcu\software\programname\data data.reg" (unicode format). need take other computer , import there program computer use data. have remove text lines data.reg. text lines easy find because contain strings (for example paths exe , dlls, specific program settings "name1=value1", "name2=value2",...). i'm doing manually (using wordpad) every few days maybe there way... oh , can't install other programs on these computers (the access restricted) have use batch/cmd files. tried far: - redirecting export "con" visual not in variable; - using "for /f ..." works ansi , removes blank lines.

the lines must removed before importing because settings of program first computer must not loaded registry keys of program second computer.

can please me...? thank you.

use code loop file contents line line

for /f %z in (yourfile.reg) ... 

then use conditionals determine if line 1 want keep

if (%z)==[put key string here] 

if (or if not), write variable target file

@echo %z >> output.reg 

you can replace filenames command line arguments, use %1, %2, etc.

all together, then:

    /f %z in (%1) if not (%z)==[skip line] @echo %z >> %2 

since didn't give critical details, making assumptions here. further reading can found @ excellent resource: http://www.robvanderwoude.com/batchfiles.php


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -