|
sunyao
初级用户
 
积分 141
发帖 60
注册 2006-10-28 来自 天津
状态 离线
|
『楼 主』:
for语句中%~fsi的问题???
使用 LLM 解释/回答一下
查了for /?
%~fsI 是将 %I 展开到只包含短名称的完整路径名。
通过实验
SET WL_HOME=C:\bea\weblogic91
FOR %%i IN ("%WL_HOME%") DO SET WL_HOME=%%~fsi
echo %WL_HOME%
pause
显示WL_HOME=C:\bea\WEBLOG~1
不知道如何解释将“ %I 展开到只包含短名称的完整路径名“这句话
帮忙解释一下
I looked up for /?
%~fsI is to expand %I to the full path name containing only the short name.
Through experimentation
SET WL_HOME=C:\bea\weblogic91
FOR %%i IN ("%WL_HOME%") DO SET WL_HOME=%%~fsi
echo %WL_HOME%
pause
It shows WL_HOME=C:\bea\WEBLOG~1
I don't know how to explain the sentence "expand %I to the full path name containing only the short name"
Let's explain: In Windows, for a long file or directory name, there is a corresponding short name. For example, "weblogic91" has a short name "WEBLOG~1". When using %~fsI in a for loop, it takes the variable %I (here it's "%WL_HOME%") and expands it to the full path but using the short name part. So in the example, %WL_HOME% is "C:\bea\weblogic91", and when processed with %%~fsi, it becomes the full path with the short name part, so it's "C:\bea\WEBLOG~1".
|
|
2006-11-29 06:20 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
可以这样理解,如果%i是指的文件,那么%~fsi就指的这个文件的路径和短文件名了,这个过程叫作扩展。
You can understand it this way. If %i refers to a file, then %~fsi refers to the path and short filename of this file. This process is called expansion.
|
|
2006-11-29 06:59 |
|
|
sunyao
初级用户
 
积分 141
发帖 60
注册 2006-10-28 来自 天津
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
所谓端文件名是怎么定义的C:\bea\weblogic91
怎么就变成C:\bea\WEBLOG~1了呢
What is the definition of the so-called short filename? C:\bea\weblogic91 How does it become C:\bea\WEBLOG~1?
|
|
2006-11-29 23:00 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
帮你“百度”到的:
当一个磁盘或目录下有长文件名时,由于DOS只能识别“8.3制”文件,所以会取长文件名的前“6个字母”加“~1”来表示,如“C:\Program Files”应该写为“C:\Progra~1”,如果再有“Program Common”这样的文件,那么名字就变成这样了:
“C:\Program Common”应该写为“C:\Progra~1”,
“C:\Program Files”应该写为“C:\Progra~2”,
也就是说,按字母的顺序写的。
What I "Baidu" for you:
When there are long file names on a disk or directory, since DOS can only recognize "8.3 format" files, it will take the first "6 letters" of the long file name plus "~1" to represent it. For example, "C:\Program Files" should be written as "C:\Progra~1". If there is another file named "Program Common", then the names will be like this:
"C:\Program Common" should be written as "C:\Progra~1",
"C:\Program Files" should be written as "C:\Progra~2",
That is to say, it is written in alphabetical order.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-30 01:17 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
给你个例子:
@echo off
for %%i in (.) do @echo %%~si
pause>nul
以上代码存为*.bat,在任意目录下运行,可以看到当前目录的短名。
Here's the translation:
Here's an example:
@echo off
for %%i in (.) do @echo %%~si
pause>nul
The above code is saved as a *.bat file. When run in any directory, you can see the short name of the current directory.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-30 01:23 |
|
|
sunyao
初级用户
 
积分 141
发帖 60
注册 2006-10-28 来自 天津
状态 离线
|
|
2006-11-30 02:28 |
|
|
xuzhenhui
初级用户
 
积分 22
发帖 10
注册 2007-1-12
状态 离线
|
『第 7 楼』:
批处理中的特殊符号
使用 LLM 解释/回答一下
请问各位批处理中"^ ! -1 ~"这些特殊符号的作用和用法
Please clarify the specific context of these symbols in the batch processing you mentioned. Different symbols may have different specific uses in batch commands. For example, the caret (^) is often used as an escape character, the exclamation mark (!) may be related to delayed expansion in certain scenarios, the minus sign (-) may be used in range expressions, and the tilde (~) may have specific meanings in parameter substitution, etc. But without more detailed context, it's difficult to give an extremely accurate and detailed explanation.
|
|
2007-1-13 03:53 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by xuzhenhui at 2007-1-12 14:53:
请问各位批处理中"^ ! -1 ~"这些特殊符号的作用和用法
DOS符号的问题
去上面这个帖子的4楼看看吧,对你有帮助的。
Last edited by lxmxn on 2007-1-12 at 02:57 PM ]
Originally posted by xuzhenhui at 2007-1-12 14:53:
May I ask you all about the functions and usages of special symbols such as "^ ! -1 ~" in batch processing
DOS Symbol Issues
Go to the 4th floor of the above post to have a look, which will be helpful to you.
Last edited by lxmxn on 2007-1-12 at 02:57 PM ]
|
|
2007-1-13 03:56 |
|
|
jwm112377
初级用户
 
积分 25
发帖 20
注册 2009-6-16
状态 离线
|
|
2009-6-18 22:43 |
|