|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 31 楼』:
使用 LLM 解释/回答一下
Re fastslz
你用的什么系统?好像是2000吧?你的 reg 和我的版本不一样,输出也不一样,你调整一下 skip= 后的值试一下调为 1 试一下,或者换为别的数字,或者去掉 skip= 。
Last edited by 无奈何 on 2006-10-3 at 12:45 ]
Re fastslz
What system are you using? It seems to be 2000? Your reg is different from my version, and the output is also different. Try adjusting the value after skip=, try setting it to 1, or change it to another number, or remove skip=.
Last edited by 无奈何 on 2006-10-3 at 12:45 ]
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2006-10-3 12:31 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2006-10-3 13:03 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 33 楼』:
使用 LLM 解释/回答一下
Re fastslz:
关于你的测试3,从你的测试1可以得到以下几点:
1.skip最好==4
2."delims= "无效。
在你的显示结果中,REG_SZ后面有8个空格的内容,这很容易联想到在windows中tab默认就占8个字符。另外,在批处理中,如果不指定delims,则默认delims=空格/Tab,所以很显然,你的"delims= "这个参数是没有效果的,反而还会使tab符失去分割令牌的作用。
建议测试以下代码:
code 1:
@echo off
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,*" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
code 2:
@echo off
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,* delims=这里是个tab" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
end:
至于你的测试4,就更不通用了,如果reg命令的输出中包含REG_SZ中任意一个字符都可能得到错误的结果。因为delims参数并非按字符串来获得分隔符,而是把delims=后面的字符串当作 分隔符集,也就是说其中任意一个字符都被视为分隔符。(区别大小写)
参考:
skip=n - 指在文件开始时忽略的行数。
delims=xxx - 指分隔符集。这个替换了空格和跳格键的
默认分隔符集。
tokens=x,y,m-n - 指每行的哪一个符号被传递到每个迭代
的 for 本身。这会导致额外变量名称的分配。m-n
格式为一个范围。通过 nth 符号指定 mth。如果
符号字符串中的最后一个字符星号,
那么额外的变量将在最后一个符号解析之后
分配并接受行的保留文本。
Re fastslz:
Regarding your test 3, the following points can be obtained from your test 1:
1. skip is best == 4
2. "delims= " is invalid.
In your display result, there is content with 8 spaces after REG_SZ, which is easily associated with the fact that tab in Windows defaults to occupying 8 characters. Also, in batch processing, if delims is not specified, the default delims is space/Tab, so it is obvious that your "delims= " parameter is ineffective, and instead, it will make the tab character lose the role of splitting tokens.
It is suggested to test the following codes:
code 1:
@echo off
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,*" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
code 2:
@echo off
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,* delims=这里是个tab" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
end:
As for your test 4, it is even less universal. If any character in REG_SZ is included in the output of the reg command, it may get an incorrect result. Because the delims parameter does not obtain the delimiter according to the string, but treats the string after delims= as the delimiter set, that is, any character in it is regarded as a delimiter. (Case-sensitive)
Reference:
skip=n - Refers to the number of lines to ignore at the beginning of the file.
delims=xxx - Refers to the delimiter set. This replaces the default delimiter set of space and tab.
tokens=x,y,m-n - Refers to which symbols of each line are passed to the for itself in each iteration. This will lead to the assignment of additional variable names. The format of m-n is a range. The mth is specified by the nth symbol. If the last character in the symbol string is an asterisk, then additional variables will be assigned after the last symbol is parsed and accept the reserved text of the line.
|
|
2006-10-3 13:18 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 34 楼』:
使用 LLM 解释/回答一下
谢谢 3742668 兄的提醒,本意添加 skip 增加一下效率,看来是多此一举了。修正一下。我现在用的是 2k3 ,看来确实有必要安个虚拟机多测试一下。
Thanks to the reminder from brother 3742668, the original intention was to add skip to increase efficiency, but it seems it was unnecessary. Make a correction. I'm using 2k3 now, and it seems it's really necessary to install a virtual machine for more testing.
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2006-10-3 14:16 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 35 楼』:
使用 LLM 解释/回答一下
谢谢3742668解答看了你参考对其有了更深的了解
现作如下总结:
1:由于我的Windows XP pro SP2 的特殊性(已经确定reg.exe未被替换过),无奈何版主的代码在我的XP里不能正常执行,而此代码在2003下能正常执行。
::无奈何版主的代码
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "skip=2 tokens=2* delims= " %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
2:3742668版主的代码在我的XP里能正常执行且此代码在2003下也能正常执行。可见3742668版主的代码通用性更强
::3742668版主的代码
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,*" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
3:关于我的Windows XP版本说明,Windows XP pro SP2产品ID属于011段的(网络上所留传的XP版本产品ID一般都属于640段的)本人使用至今发现这2个版本XP确实有所不同。
XP补丁已全部更新至2006-10,已安装.NET Framework 2.0。能有区别的也就这些了。reg.exe MD5:7f1e65bde053985ba645340bc0cf6497
Thanks to 3742668 for the solution. After reading your reference, I have a deeper understanding.
The following is the summary:
1: Due to the particularity of my Windows XP pro SP2 (it has been confirmed that reg.exe has not been replaced), unfortunately, the version master's code cannot be executed normally in my XP, while this code can be executed normally in 2003.
:: Version master's code
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "skip=2 tokens=2* delims= " %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
2: The version master's code of 3742668 can be executed normally in my XP and this code can also be executed normally in 2003. It can be seen that the version master's code of 3742668 has stronger universality
:: Version master's code of 3742668
set reg="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
for /f "tokens=2,*" %%i in ('reg query %reg% /v "Favorites"') do set Favorites=%%j
echo %Favorites%
pause
3: Regarding the description of my Windows XP version, the Windows XP pro SP2 product ID belongs to the 011 segment (the generally passed XP version product ID on the network generally belongs to the 640 segment). I have found that these two versions of XP are indeed different since I have been using it.
All XP patches have been updated to 2006-10, and the.NET Framework 2.0 has been installed. These are the only differences. reg.exe MD5: 7f1e65bde053985ba645340bc0cf6497
|

第一高手 第二高手
我的小站
 |
|
2006-10-3 14:32 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 36 楼』:
使用 LLM 解释/回答一下
呵呵...无奈何版主也没有睡呀,辛苦了、注意身体哦 
Hehe...It seems the moderator hasn't slept yet either. You've worked hard, take care of your health哦:)
|

第一高手 第二高手
我的小站
 |
|
2006-10-3 14:38 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 37 楼』:
使用 LLM 解释/回答一下
vbs版本的写了两个功能,昨天晚上传上来修改的时候又稀里糊涂地删掉了,今天重新传上来,大家帮忙测试。
附件解压到目录后运行其中的 安装.vbs 就可以安装上了。
因为这几天忙得狠,又微感小恙,代码没组织好,乱得狠,高人们别偷笑。
The VBS version has two functions. I accidentally deleted it when I uploaded and modified it last night. I'm uploading it again today. Everyone, please help test it.
After extracting the attachment to the directory, run the "Install.vbs" in it to install.
Because I've been very busy these days and a little under the weather, the code isn't well-organized and is very messy. Don't laugh at the experts.
附件
1: SendTo+(VBS版).rar (2006-10-6 11:02, 3.29 KiB, 下载附件所需积分 1 点
,下载次数: 100)
|
|
2006-10-6 11:02 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 38 楼』:
使用 LLM 解释/回答一下
vbs版的我喜欢^_^
The VBS version I like ^_^
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-8 05:42 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 39 楼』:
使用 LLM 解释/回答一下
我也下载试用了,vbs版的精简一点
electronixtar 你的vbs功底也了得,改天也露一手呀^_^
I also downloaded and tried it. The VBS version is more streamlined.
electronixtar, your VBS skills are also remarkable. Let's show off some time later ^_^
|

第一高手 第二高手
我的小站
 |
|
2006-10-8 05:48 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 40 楼』:
使用 LLM 解释/回答一下
寒~~我写的vbs就当片断好了。和版主们还差得远
Cold~~ What I wrote in VBS is just a fragment. There's still a long way to go compared to the moderators.
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-10-8 07:00 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 41 楼』:
使用 LLM 解释/回答一下
谢谢 3742668
辛苦了,好身体最重要,我最近也感觉哪都不舒服。
试用先!
Thanks 3742668
Hard work, good health is the most important. I also feel uncomfortable everywhere recently.
Try it first!
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2006-10-10 23:50 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 42 楼』:
使用 LLM 解释/回答一下
今天检查了一下3个脚本,发觉有点小毛病,不过并不影响使用,不知道有没有测试出有问题的?
至于另外几个功能,都比较简单,都没有人尝试的吗?
Today I checked 3 scripts and found a few minor issues, but they don't affect usage. I wonder if anyone has tested and found problems? As for the other functions, they are all relatively simple. Has no one tried them?
|
|
2006-10-12 07:30 |
|
|
hxuan999
中级用户
   DOS之日
积分 337
发帖 161
注册 2006-11-4
状态 离线
|
『第 43 楼』:
使用 LLM 解释/回答一下
支持 无奈何
|

for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul |
|
2006-11-23 05:02 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 44 楼』:
使用 LLM 解释/回答一下
非常精彩的贴子~~无限欣赏~:)
Very wonderful post~~ Admire infinitely~:)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-25 03:11 |
|
|
tao0610
高级用户
    朦胧的世界
积分 579
发帖 218
注册 2006-10-24
状态 离线
|
『第 45 楼』:
使用 LLM 解释/回答一下
一起欣赏。。。
Enjoy together...
|

认识自己,降伏自己,改变自己,才能改变别人! |
|
2006-11-25 03:44 |
|