![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-09 12:57 |
47,811 topics / 349,895 posts / today 0 new / 48,254 members |
| DOS批处理 & 脚本技术(批处理室) » Can the delims= in for be a string? |
| Printable Version 6,072 / 29 |
| Floor1 26933062 | Posted 2007-05-25 23:42 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Can I do this with the for command like this?
@echo off set "var=333ps555psssword=123 456 789" for /f "tokens=1* delims=psssword" %%i in ("%var%") do set str=%%i&set num=%%j echo %str% %num% pause My original intention was Set str=333ps555 num==123 456 789 But the result is str=333 num=555psssword=123 456 789 Why does the result of my run use p or s as the delimiter instead of psssword? [ Last edited by 26933062 on 2007-8-13 at 12:13 AM ] |
|
| Floor2 bjsh | Posted 2007-05-26 00:07 |
| 银牌会员 Posts 621 Credits 2,000 | |
|
delims=psssword
Will use these letters as delimiters; not just p and s, w, o, r, d will also be used as delimiters; delims cannot be used as delimiters for the string; |
|
| Floor3 26933062 | Posted 2007-05-26 00:10 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Oh. So that's it, it means it can only use a single letter or symbol as a separator, right?
[ Last edited by 26933062 on 2007-8-11 at 05:59 AM ] |
|
| Floor4 lxmxn | Posted 2007-05-26 00:36 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by 26933062 at 2007-5-26 00:10: This is how the delims option of the for command works. To use the string "psssword" as a delimiter, I only know that the gawk tool can do it. You can find the download address by searching in the forum. |
|
| Floor5 26933062 | Posted 2007-05-26 00:40 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Oh. Thanks, but I won't use tools,...
Mainly learning batch processing,... |
|
| Floor6 lxmxn | Posted 2007-05-26 00:49 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by 26933062 at 2007-5-26 00:40: Sometimes using some tools can solve many problems, but I don't force it. Although the delims option of the for command doesn't support string splitting, if you want to achieve your goal, changing the idea might also work: |
|
| Floor7 sunshine217 | Posted 2007-06-02 21:25 |
| 新手上路 Posts 1 Credits 0 | |
| Floor8 baikaifang | Posted 2007-06-02 21:53 |
| 初级用户 Posts 32 Credits 68 | |
|
Dear all experts, why don't you write comments for the commands? It makes us noobs confused. Some strange characters used in them can't be found online for their usage. As a result, reading them is like not reading. I don't know the specific meaning of each command, and then I can't apply what I've learned to other problems.
|
|
| Floor9 qingfushuan | Posted 2007-06-04 11:57 |
| 高级用户 Posts 327 Credits 502 | |
Originally posted by baikaifang at 2007-6-2 09:53 PM: It's like looking at things through a mist! 3D pictures are seen like that. If you persist in looking for three months, you'll understand. I started looking through a mist last December, and now I can see 3D pictures. |
|
| Floor10 step2step | Posted 2007-06-04 15:05 |
| 初级用户 Posts 25 Credits 44 | |
|
The first part was understood, but the latter part is like天书.
|
|
| Floor11 huyujuen121 | Posted 2007-08-03 08:28 |
| 新手上路 Posts 5 Credits 9 | |
|
Yeah, it's all like天书.
|
|
| Floor12 slore | Posted 2007-08-03 10:12 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
A few seconds for the 3D picture is okay.
|
|
| Floor13 sting | Posted 2007-08-08 10:02 |
| 初级用户 Posts 23 Credits 45 | |
| Floor14 1112yuhua | Posted 2007-08-16 01:26 |
| 初级用户 Posts 44 Credits 106 | |
|
Moderator lxmxn is really excellent, replacing password with _.
|
|
| Floor15 liuyun20 | Posted 2007-10-18 22:56 |
| 初级用户 Posts 14 Credits 36 | |
|
set "var=%var:psssword=_%", replaced password with _.
Learned. |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |