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-29 10:02
中国DOS联盟论坛 » 其它操作系统综合讨论区 » [fixed] How to display a string containing &? View 1,457 Replies 14
Original Poster Posted 2009-02-10 12:43 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Please look at this example:
@echo off
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1



! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum
1 REG_SZ ACPI\PNP0303\4&30647147&0

Press any key to continue . . .


@echo off
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1
for /f "tokens=3" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1 ^|findstr "REG_SZ"') do @set K1=%%a
echo %K1%
pause



! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum
1 REG_SZ ACPI\PNP0303\4&30647147&0

ACPI\PNP0303\4
'30647147' is not recognized as an internal or external command,
operable program or batch file.
'0' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .


How can I fix this error? Thanks!



———————————————————————
Moved from DOS Troubleshooting & Problem Discussion (Answer Room)
Obviously posted in the wrong section, points deducted accordingly.
——Administrator
———————————————————————


[ Last edited by chishingchan on 2009-2-12 at 01:26 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
DOSroot -6 2009-02-10 13:06
Floor 2 Posted 2009-02-10 20:06 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Can't be helped, the forum categories seem a bit vague, since my question involves both DOS batch files and the Windows registry. It doesn't matter if points are deducted, take it as a lesson, but what I most hope for is that the problem can be solved.
Floor 3 Posted 2009-02-10 20:44 ·  中国 上海 电信
管理员
★★
Credits 389
Posts 198
Joined 2008-09-23 12:00
17-year member
UID 126405
Gender Male
Status Offline
It's all right. If I deducted points by mistake I can add them back to you.

Let's discuss what category your problem falls under. It's true that sometimes I also feel confused when using a DOS method to solve a Windows problem—is this a DOS problem or a Windows problem? But in your case I really can't see what it has to do with DOS.

If you want to solve similar problems with batch files in the future, you can post them in the "Batch File Room".
Floor 4 Posted 2009-02-10 22:01 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
How should I put it? This is the discussion area, so it also seems reasonable for my question to be in 《DOSTroubleshooting & Problem Discussion (Answer Room) 》. Anyway, this isn't important. It doesn't matter if points were deducted. Could the administrator help solve this problem?


Also, do CMD commands belong to Windows or to DOS?]]>

[ Last edited by chishingchan on 2009-2-10 at 22:05 ]
Floor 5 Posted 2009-02-10 22:39 ·  中国 上海 电信
管理员
★★
Credits 389
Posts 198
Joined 2008-09-23 12:00
17-year member
UID 126405
Gender Male
Status Offline
Originally posted by chishingchan at 2009-2-10 22:01:

Also, do CMD commands belong to Windows or to DOS?


As someone who registered around the time the forum was founded, and who has already reached the "Silver Member" level, seeing you ask a question like this really leaves me surprised.

I assume you must know willsort. If you're not clear on this concept, please take a look at his post:

http://www.cn-dos.net/forum/viewthread.php?tid=20682

Just read the first paragraph.
Floor 6 Posted 2009-02-11 01:49 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
This article is written so well, just like the way he describes his own software. It's the first time I've come across it, and I've learned from it.
I registered in 2002, and Silver Member is actually not much. Earlier, because I forgot my password, I even registered another account called chishing. I forgot what rank that one was. Also, I'm not very active on this forum. I only think of coming here when I run into difficulties. Honestly speaking, the knowledge I've learned from this forum has helped me a great deal, and I also thank the enthusiastic moderators for answering my questions, thank you!
Actually, many of the forum's veteran members are probably like me, dropping by here from time to time whenever they go online, because sometimes the posts I reply to and the difficult questions I raise also take a long time before anyone responds.
I also admit I'm getting a bit older. It's not like I can use many commands or techniques whenever I want; I have to look at examples before I can write a program, just like flipping through a book during an open-book exam. Besides, DOS is only auxiliary for me. If I come up with a piece of software, could I really just know DOS and then write a program to sell? DOS can't do that.
Right now I'm also learning VBS. After all, under Windows its auxiliary value is greater than DOS's, and I've had a little success with it, but I still have to look things up before writing, because I can't remember it all.
I've said too much...

Back to the main topic, could the administrator help with the question in the top post?
Floor 7 Posted 2009-02-11 05:18 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 8 Posted 2009-02-11 09:05 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Thanks to moderator HAT for the answer, but it still doesn't quite work, because the obtained value still has another use.
@echo off
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1
for /f "tokens=3" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1 ^|findstr "REG_SZ"') do @set K1=%%a
echo "%K1%"
pause


! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum
1 REG_SZ ACPI\PNP0303\4&30647147&0

"ACPI\PNP0303\4&30647147&0"
Press any key to continue . . .


Use the retrieved variable as part of a parameter and add a multi-string value:
REG ADD "HKLM,SYSTEM\CurrentControlSet\Enum\%K1%" /v UpperFilters /t  REG_MULTI_SZ /d BeTwinKeyboard


Error: Invalid key name
Press any key to continue . . .


[ Last edited by chishingchan on 2009-2-11 at 09:24 ]
Floor 9 Posted 2009-02-11 13:08 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 10 Posted 2009-02-11 13:12 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Originally posted by HAT at 2009-2-11 01:08 PM:
@echo off
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1
for /f "tokens=3" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclas ...


Thanks! I think it should work, but I can't explain why clearly either—this key actually says access denied.
System: XP SP2
User: Administrator
After running:
! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum
1 REG_SZ ACPI\PNP0303\4&30647147&0


Error: Access is denied.
Press any key to continue . . .
Floor 11 Posted 2009-02-11 20:53 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Yes, by default everyone has read permission on that branch. You can use the regini command to modify its permissions.
Floor 12 Posted 2009-02-11 22:05 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Originally posted by HAT at 2009-2-11 08:53 PM:
Yes, by default everyone has read permission on that branch. You can use the regini command to modify its permissions.


When I run regini directly nothing happens, and /? also gives no response. How do I modify the permissions?
Floor 13 Posted 2009-02-11 22:15 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 14 Posted 2009-02-12 01:14 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,284
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Floor 15 Posted 2009-02-13 02:38 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
@echo off
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1
for /f "tokens=3" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1 ^|findstr "REG_SZ"') do @set K1=%%a
echo %K1%
pause


As for the problem in the first post,
it seems this can also display normally:

@echo off&setlocal enabledelayedexpansion
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1
for /f "tokens=3" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\Kbdclass\Enum" /v 1 ^|findstr "REG_SZ"') do @set “K1=%%a”
echo !K1!
pause
endlocal
精简
=> 个人网志
Forum Jump: