![]() |
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-06 07:13 |
48,039 topics / 350,124 posts / today 2 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Can't you add a path in the in? |
| Printable Version 2,279 / 7 |
| Floor1 secowu | Posted 2007-10-16 12:51 |
| 初级用户 Posts 92 Credits 201 | |
|
I learned from the forum that this command is very useful to get the single file name + extension name
for /r %a in (*.*) do @if exist %a echo %~nxa Encountered the following problems: 1. Can you add a path after in? Like this: for /r %a in (%CD%\*.*) do @if exist %a echo %~nxa But it doesn't run 2. If you want to get the complete path name, file and extension name, how to do it? Like this result: C:\Windows\notepad.exe c:\windows\hh.exe Thanks for the advice |
|
| Floor2 secowu | Posted 2007-10-16 12:53 |
| 初级用户 Posts 92 Credits 201 | |
|
For the second point, it can be solved like this. Just not that straightforward.
|
|
| Floor3 secowu | Posted 2007-10-16 12:57 |
| 初级用户 Posts 92 Credits 201 | |
| Floor4 lxmxn | Posted 2007-10-16 18:38 |
| 版主 Posts 4,938 Credits 11,386 | |
1. Can the path be added after in? Generally, put the path after the /R parameter, and the file type in in: 2. If you want to get the complete path name, file and suffix name, how to do it? Take a look at the help of for! |
|
| Floor5 hxwxyz | Posted 2007-10-16 19:33 |
| 中级用户 Posts 123 Credits 245 | |
| Floor6 secowu | Posted 2007-10-20 10:36 |
| 初级用户 Posts 92 Credits 201 | |
Generally, the path is placed after the /R parameter, and the file type is placed in in: --There is a problem. This will enumerate the directories under this directory, including subdirectories. How to only specify this directory without including its subdirectories? |
|
| Floor7 lxmxn | Posted 2007-10-20 14:14 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Refer to for /D.
[ Last edited by lxmxn on 2007-10-20 at 02:15 PM ] |
|
| Floor8 secowu | Posted 2007-10-23 13:47 |
| 初级用户 Posts 92 Credits 201 | |
Originally posted by lxmxn at 2007-10-20 14:14: Thank you very much... |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |