China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 16:25
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to automatically find a certain registry key value View 828 Replies 3
Original Poster Posted 2007-05-23 04:01 ·  中国 河北 石家庄 桥西区 联通
初级用户
Credits 54
Posts 28
Joined 2006-10-16 14:23
19-year member
UID 65980
Gender Male
Status Offline
I want to modify the registry
HKEY_USERS\S-1-5-21-746137067-602162358-725345543-500\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\0
"DisplayName"="my own name"

But this key value seems to be different on every system... How should I write it so it can automatically find this key value????? Please help, experts

[ Last edited by lzys on 2007-5-23 at 04:21 AM ]
Floor 2 Posted 2007-05-23 09:48 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Try this, see if it works:
Because S-1-5-21-746137067-602162358-725345543-500 is different on every computer;
I get it with 'reg query HKU^|findstr /v "_Classes"^|findstr "S-1-5-21"';
it should have pretty good compatibility; but I haven't tested it;

@echo off
for /f %%a in ('reg query HKU^|findstr /v "_Classes"^|findstr "S-1-5-21"') do (
reg query %%a\Software\Microsoft\Windows\CurrentVersion\\"Internet Settings"\Lockdown_Zones\0 /v DisplayName
)


Here I'm only doing reg query and not modifying it;

If you want to modify it;
refer to the above code and reg /? and make the changes yourself.
Floor 3 Posted 2007-05-23 15:47 ·  中国 河北 石家庄 桥西区 联通
初级用户
Credits 54
Posts 28
Joined 2006-10-16 14:23
19-year member
UID 65980
Gender Male
Status Offline
I'm dizzy now, maybe I'm just too dumb. I studied it for quite a while and still couldn't complete the code after that... Moderator, please help again... after v DisplayName I really don't know what code to add
Floor 4 Posted 2007-05-23 16:04 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Take a look at reg add /?
Change my reg query to reg add, as for the format refer to the following;

Windows Console Registry Tool - Version 3.0
Copyright (C) Microsoft Corp. 1981-2001. All rights reserved.


REG ADD KeyName

KeyName FullKey
Remote machine name - omitted defaults to the current machine.
On remote machines only HKLM and HKU are available.
FullKey ROOTKEY\SubKey
ROOTKEY
SubKey The full name of the registry key under the selected ROOTKEY

/v The value name to add under the selected key

/ve Adds an empty value name <No Name> to the registry key

/t RegKey data type



If omitted, REG_SZ is assumed

/s Specifies a character to use as the separator
in a REG_MULTI_SZ data string
If omitted, "\0" is used as the separator

/d The data to assign to the registry ValueName being added

/f Force overwriting the existing registry entry without prompting
Forum Jump: