Hello. There is a registry path HKEY_LOCAL_MACHINE \ Software \ Mytest , it has a parameter LIST , in which 3 variables are scattered line by line.

Task: Check this parameter for the presence of extraneous variables and delete them, without affecting the 3 that were originally entered.

Please tell me how to solve this problem exclusively using cmd / bat.

    2 answers 2

    While there is no additional information, I can only advise the command reg.exe, which appeared since windows xp. Read the help to the utility, can do it yourself, or specify the question itself.

    Ps Can it make sense to look in the direction of powershell?

    • Unfortunately, only cmd / bat functions are available. The solution has already been found with the help of reg.exe. prompted user evlanoff with Bitcode. But nevertheless - thanks. - naxa

    In fact, no one bothers to use the regedit /e имя_файла.reg ИМЯ_ВЕТКИ for saving / restoring the registry branch of the call on the command line. Thus, you can save only the necessary registry key settings, instead of looking for extra ones.

    • it's not exactly that. the fact is that the batch file that needs to be created must run on different machines ( only the batch file, without backup registry keys), on some systems the LIST parameter will be clean, on others it will not. it is necessary that the batch file is in semi - automatic mode to perform cleaning, without user assistance. at the moment it is implemented approximately as you advised - the content is checked, the info is displayed on the screen, if there are extra lines - the user presses the button - this key is deleted and a new one is created, but this requires a user, this is not acceptable. - naxa
    • And how can you know which keys are superfluous? There is actually a way even simpler than the first: to prohibit users from changing certain registry branches! But I'm not sure that it works on all versions of Windows. In addition, it requires some skill setting user policies. - areshin
    • The "correct" data is embedded in the conditions of the executable code, all excess data is deleted if found. what you advise is not suitable, since it requires prior access to the system, for locked access to the registry. it's impossible. there is no access, there is only a ready machine on which it is necessary to execute code to clean the registry key. such conditions of the task, the other is not given. - naxa
    • Although - why then catch extra lines? Well, while tactics are known, but the strategy is incomprehensible! Maybe you will open, finally, what is all this for? - areshin
    • Dear, if you are not able to understand the essence of the question, then do not try to answer and even more so you should not be rude! flag in your hands and advise you to go to the forest. - naxa