![]() |
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-11-10 14:07 |
47,815 topics / 349,930 posts / today 0 new / 48,291 members |
| DOS批处理 & 脚本技术(批处理室) » Extract the line-by-line content of the file and perform operations. Problem! Please ask the experts to help solve it! |
| Printable Version 4,840 / 24 |
| Floor16 piziliu2004 | Posted 2006-06-12 11:24 |
| 中级用户 Posts 139 Credits 321 | |
|
Thanks.!
willsort Moderator |
|
| Floor17 wydos | Posted 2006-06-12 12:44 |
| 中级用户 Posts 117 Credits 304 | |
|
How to extract the content of the first line of a txt file and use this line content to rename the file? Can you process multiple files at once?
|
|
| Floor18 3742668 | Posted 2006-06-12 17:51 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
###
The following code basically meets your requirements: |
|
| Floor19 wydos | Posted 2006-06-12 21:30 |
| 中级用户 Posts 117 Credits 304 | |
|
First, thank you to the moderator!
But it doesn't seem to work! Can you explain the function of each line of code, thank you!!! |
|
| Floor20 wydos | Posted 2006-06-12 21:52 |
| 中级用户 Posts 117 Credits 304 | |
|
I changed "%*" to "*.txt", but it doesn't work for files with space in the file name. I hope the moderator can improve it.
Also, I still don't understand the meaning of the code. Can the moderator explain it again? Thanks! |
|
| Floor21 namejm | Posted 2006-06-12 22:35 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
If the file name has spaces, the solution is the same as when the path has spaces, just add quotes.
|
|
| Floor22 3742668 | Posted 2006-06-13 11:44 |
| 荣誉版主 Posts 718 Credits 2,013 | |
It needs parameters when running, and it can handle cases with spaces in my test. set /p filename=<%%i is used to read the content of the first line of the text. Several commands are very simple, you can refer to Help and Support and should be able to understand it yourself. You can create a shortcut of this batch processing in the sendto directory, so that you can directly select batch renaming with the mouse. |
|
| Floor23 wydos | Posted 2006-06-13 19:25 |
| 中级用户 Posts 117 Credits 304 | |
|
Today I studied it and basically understood it.
But there are still some doubts and I want to ask the moderator. Is "%*" referring to "*.*"? Are the parameters you mentioned also referring to "*.*"? If I want to modify txt, I can input: "1 *.txt", is my understanding correct? Also, the usage of "do ( )" in the for statement is something I've seen for the first time (that is, "()" after do). There doesn't seem to be an introduction in Help and Support. Can you introduce its usage? |
|
| Floor24 bagpipe | Posted 2006-06-14 09:59 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
Please check the CALL /? help. This means all parameters of the batch processing. I think the person upstairs made a mistake because they were not clear about this.
|
|
| Floor25 wydos | Posted 2006-06-14 14:19 |
| 中级用户 Posts 117 Credits 304 | |
|
Thanks to post 24!
I happened to see in the CALL /? help today and finally understand!!! But where is the introduction to the "do ( )" usage of the for statement? Can post 24 answer it, thanks!!! |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |