Re chenhui530:
The methods of you and I should both have ignored the situations where there are spaces and colons in the connection name. I made a slight modification based on your code.
Interestingly, it was found that in the command output of ipconfig, the end of each line of text is two carriage returns (0x0D) and one newline (0x0A). So when I initially tested with delims=2*, a series of interesting setting confusions occurred, such as I could use it to hide the first character of the environment variable name. But later I remembered that Brother Wu Nai He first discovered this phenomenon in the forum, and the link is as follows:
(Solved) Please ask how to capture a specific line of text in a file
http://www.cn-dos.net/forum/viewthread.php?tid=17443#pid102925
I don't know if this is a bug in the program or a special requirement in some special applications. But it does bring some small troubles to our use in batch processing.
[ Last edited by willsort on 2005-11-15 at 16:29 ]
The methods of you and I should both have ignored the situations where there are spaces and colons in the connection name. I made a slight modification based on your code.
Interestingly, it was found that in the command output of ipconfig, the end of each line of text is two carriage returns (0x0D) and one newline (0x0A). So when I initially tested with delims=2*, a series of interesting setting confusions occurred, such as I could use it to hide the first character of the environment variable name. But later I remembered that Brother Wu Nai He first discovered this phenomenon in the forum, and the link is as follows:
(Solved) Please ask how to capture a specific line of text in a file
http://www.cn-dos.net/forum/viewthread.php?tid=17443#pid102925
I don't know if this is a bug in the program or a special requirement in some special applications. But it does bring some small troubles to our use in batch processing.
@echo off
for /f "skip=3 tokens=2*" %%a in ('ipconfig') do set AccessName=%%b&& goto AccName2
:AccName2
set AccessName=%AccessName:~0,-2%
echo Access: "%AccessName%"
[ Last edited by willsort on 2005-11-15 at 16:29 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!

