![]() |
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-07 05:34 |
48,040 topics / 350,125 posts / today 1 new / 48,252 members |
| DOS批处理 & 脚本技术(批处理室) » What does "~na" mean in for? |
| Printable Version 1,678 / 9 |
| Floor1 caucfeiyu | Posted 2007-04-14 12:36 |
| 初级用户 Posts 35 Credits 108 From 河北廊坊 | |
|
What does %~na mean in "for /r g:\mp3 %a in (*.mp3) do @echo %~na"?
In the for /? help: %~I expands %I by removing any surrounding quotes (""). %~fI expands %I to the fully qualified pathname. %~dI expands %I to just the drive letter. %~pI expands %I to just the path. %~nI expands %I to just the file name. %~xI expands %I to just the file extension. %~sI expands the path to only contain the short name. %~aI expands %I to the file attributes of the file. %~tI expands %I to the date and time of the file. %~zI expands %I to the file size. Here it says "expands %I to the fully qualified pathname" and "expands %I to just the drive letter", what does this mean? I don't quite understand. Can you give an example to explain it? |
|
| Floor2 bjsh | Posted 2007-04-14 21:27 |
| 银牌会员 Posts 621 Credits 2,000 | |
|
Isn't it written above?
Expand to the file name; For example, there is a test.mp3 in g:\mp3 If you just echo %a, it will echo as g:\mp3\test.mp3 If you echo %~na, it will echo as test Only the file name itself |
|
| Floor3 htysm | Posted 2007-04-14 21:55 |
| 高级用户 Posts 415 Credits 866 | |
|
@echo off
:: Please place this batch file on the desktop and run it. echo The fully qualified pathname of this batch file is: %~f0 echo The drive letter of this batch file is: %~d0 pause>nul |
|
| Floor4 caucfeiyu | Posted 2007-04-14 23:13 |
| 初级用户 Posts 35 Credits 108 From 河北廊坊 | |
|
Thanks everyone, got it!
Been to so many forums, but this one is the best! It has a human touch! Haha~!~!~! |
|
| Floor5 tongwandou | Posted 2007-04-15 04:58 |
| 初级用户 Posts 50 Credits 112 | |
|
Learned a little more! Thanks!
|
|
| Floor6 jackson313 | Posted 2007-04-15 14:41 |
| 初级用户 Posts 26 Credits 48 | |
|
Thanks for sharing, saved it
|
|
| Floor7 minmin888 | Posted 2007-04-21 09:54 |
| 初级用户 Posts 62 Credits 127 | |
|
Thanks everyone, got it!
|
|
| Floor8 fdasf | Posted 2007-04-22 00:00 |
| 新手上路 Posts 1 Credits 2 | |
|
Okay, support the fall
|
|
| Floor9 haiou327 | Posted 2008-01-05 17:13 |
| 高级用户 Posts 348 Credits 713 | |
|
Easy to understand, plus points.
|
|
| Floor10 DarksKy1984 | Posted 2008-01-07 19:41 |
| 初级用户 Posts 24 Credits 46 | |
|
Thanks for sharing
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |