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-07-31 16:40
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] -------- bat and reg mixed programming (tested successfully under XP) -------- View 1,124 Replies 9
Original Poster Posted 2008-08-18 20:31 ·  中国 北京 海淀区 联通
银牌会员
★★★
Credits 2,098
Posts 566
Joined 2007-09-11 07:27
18-year member
UID 97070
Gender Male
Status Offline
REGEDIT4

;@cls&regedit/s "%~f0"&goto bat

/*
bat-reg {s11ss@www.cn-dos.net 2008-8-18}
:bat
:bat code section -------- start
@echo off
echo Successfully added key CN-DOS under HKEY_CURRENT_USER!
pause
exit/b
bat code section -------- end
*/

#reg code section -------- start

#reg code section -------- end
Recent Ratings for This Post ( 4 in total) Click for details
RaterScoreTime
qzwqzw +9 2008-08-18 23:41
lxmxn +8 2008-08-19 18:28
yishanju +4 2008-08-20 10:42
flyinspace +9 2008-08-20 10:44
Floor 2 Posted 2008-08-18 20:41 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
Hard to understand... ^_^
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 3 Posted 2008-08-20 10:31 ·  中国 黑龙江 大庆 大庆中基石油通信建设有限公司
高级用户
★★
Credits 547
Posts 261
Joined 2006-04-15 16:50
20-year member
UID 53887
Status Offline
Originally posted by s11ss at 2008-8-18 20:31:
REGEDIT4

;@cls&regedit/s "%~f0"&goto bat

/*
bat-reg {s11ss@www.cn-dos.net 2008-8-18}
:bat
:bat code section -------- start
@echo off
echo Successfully added key CN-DOS under HKEY_CURREN ...

Could you give an example to learn from? It'd be even better if there were a detailed explanation.
Floor 4 Posted 2008-08-20 10:42 ·  中国 北京 门头沟区 光环新网联通数据中心
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
So cool, brilliant

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 5 Posted 2008-08-20 10:44 ·  中国 广东 广州 天河区 电信
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
Not bad. Very excellent.
知,不觉多。不知,乃求知
Floor 6 Posted 2008-08-20 12:57 ·  中国 广东 深圳 电信
初级用户
Credits 59
Posts 28
Joined 2007-03-23 05:18
19-year member
UID 82622
Gender Male
Status Offline
I don't quite understand whether the content of the article is about reg or about bat.
The REG part isn't very clear either.
And the REGEDIT4 and REGEDIT5 headers are supposed to be for different operating system versions, right?

Hope someone who knows can explain.
Floor 7 Posted 2008-08-20 14:43 ·  中国 广东 广州 天河区 电信
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
It just makes use of the characteristics of the header. (used quite cleverly)
Put the OP's thing into

1.bat and try it. Then you'll understand.
知,不觉多。不知,乃求知
Floor 8 Posted 2008-08-20 19:44 ·  中国 江苏 无锡 宜兴市 电信
中级用户
★★
Credits 487
Posts 212
Joined 2007-04-01 08:22
19-year member
UID 83597
Gender Male
Status Offline
Hehe, mixed programming? I'll show my support. I quite like using INF, VBS, BAT, and REG mixed programming...
Floor 9 Posted 2008-08-20 20:51 ·  中国 江苏 苏州 常熟市 电信
高级用户
★★
五星老土
Credits 558
Posts 172
Joined 2003-02-09 00:00
23-year member
UID 881
Gender Male
From 江苏
Status Offline
I didn't understand it. Although I know what it did, I still didn't understand it.

To sum up what I didn't understand:

1. REGEDIT4 isn't a command at all. In a batch file it would give an error message, but here it's gone in a flash, maybe covered up by the immediately following "CLS" command. But some people said the header was used cleverly, so I'm still a bit puzzled. Is that what they meant?

2. The ";" on the 2nd line, doesn't that normally mean it gets ignored? But here...?

3. Then the "/*" on the 3rd line, I understand even less.

4. Then after that the "#", now I'm completely dizzy.

5. To get the final result, doing it in BAT wasn't really difficult in the first place, so what is writing it like this supposed to show? Does it have any practical prospects? Because I completely can't understand it, I can't make sense of it.

Could post #4, #5, and everyone who gave it points clear up my confusion? Thanks.
我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已.
Floor 10 Posted 2008-08-21 07:13 ·  中国 湖北 武汉 联通
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by quya at 2008-8-20 20:51:
I didn't understand it. Although I know what it did, I still didn't understand it.

To sum up what I didn't understand:

1. REGEDIT4 isn't a command at all. In a batch file it would give an error message, but here it's gone in a flash, ma ...

If you analyze the OP's code separately using the way of thinking for batch files and for registry scripts, you can understand it. The two scripts (actually integrated into one script) accomplish the same function of adding a registry key.
Forum Jump: