![]() |
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-10-26 17:37 |
47,815 topics / 349,928 posts / today 0 new / 48,288 members |
| DOS批处理 & 脚本技术(批处理室) » Ask about reading the content of a txt file into a variable under pure DOS |
| Printable Version 6,244 / 19 |
| Floor16 NaturalJ0 | Posted 2006-09-01 17:14 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
### 首先看第一部分:
#### 关于 `namepass.txt` 文件内容 `namepass.txt` 文件里有两行内容,分别是 `username` 和 `password`,应该是用来存储用户名和密码相关信息的文件。 #### 关于 `.bat` 文件相关操作 - `echo set username=%%0 >username.bat`:这行是在创建 `username.bat` 文件并向其中写入内容 `set username=%0`,`%0` 在批处理中表示当前批处理文件的文件名。 - `echo set password=%%0 > password.bat`:同理,是创建 `password.bat` 文件并写入 `set password=%0`。 - `find namepass.txt /i "username" >temp1.bat`:这行是在 `namepass.txt` 文件中查找包含 `username`(不区分大小写 `/i`)的内容,并将结果输出到 `temp1.bat` 文件中。不过后面 `find namepass. ...` 看起来可能是内容没完整显示,推测是继续从 `namepass.txt` 文件中查找相关内容并输出到其他批处理文件中,整体这些批处理操作可能是在从 `namepass.txt` 文件中提取用户名和密码相关信息并进行存储或进一步处理的操作。 但是由于你提供的内容有部分不完整(`find namepass. ...` 没完整显示),所以只能大致解释到这里。 The following is the translation of the relevant explanation part: First, look at the first part: #### Regarding the content of the `namepass.txt` file The `namepass.txt` file has two lines of content, namely `username` and `password`, which should be used to store information related to the username and password. #### Regarding the relevant operations of the `.bat` file - `echo set username=%%0 >username.bat`: This line is to create the `username.bat` file and write the content `set username=%0` into it. In batch processing, `%0` represents the file name of the current batch processing file. - `echo set password=%%0 > password.bat`: Similarly, it is to create the `password.bat` file and write `set password=%0` into it. - `find namepass.txt /i "username" >temp1.bat`: This line is to find the content containing `username` (case-insensitive `/i`) in the `namepass.txt` file and output the result to the `temp1.bat` file. However, the subsequent `find namepass. ...` seems to be that the content is not completely displayed. It is speculated that it is to continue to find relevant content from the `namepass.txt` file and output it to other batch processing files. In general, these batch processing operations may be operations of extracting relevant information of the username and password from the `namepass.txt` file and storing or further processing it. But since part of your provided content is incomplete (`find namepass. ...` is not completely displayed), so it can only be roughly explained here. |
|
| Floor17 electronixtar | Posted 2006-10-18 00:03 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Search, search, search again and again
http://www.cn-dos.net/forum/viewthread.php?tid=23697&fpage=1&highlight=%E4%B8%80%E5%8F%A5%E8%AF%9D |
|
| Floor18 done | Posted 2006-10-18 00:47 |
| 新手上路 Posts 5 Credits 9 | |
| Floor19 lxmxn | Posted 2006-10-18 01:21 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by NaturalJ0 at 2006-9-1 17:14: I don't quite understand either? Why create the username.bat and password.bat files, and then delete them directly without calling them? |
|
| Floor20 NaturalJ0 | Posted 2006-10-18 05:26 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
当时没看懂,现在过了N天了,回头来看,才发现经典。
![]() |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |