China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-20 15:17
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Collection of DOS Command Tips View 5,696 Replies 23
Floor 16 Posted 2006-10-24 10:30 ·  中国 湖南 常德 电信
新手上路
Credits 1
Posts 1
Joined 2006-10-23 01:54
19-year member
UID 67789
Gender Male
Status Offline
Although I don't understand it very well, I'll support you first!
Floor 17 Posted 2006-10-26 01:38 ·  中国 广东 深圳 福田区 电信
初级用户
★★
Credits 133
Posts 57
Joined 2006-03-15 23:12
20-year member
UID 52128
Status Offline
First time seeing this
%0
Floor 18 Posted 2006-10-26 09:22 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  There are many more...

~I - Remove any quotes ("), expand %I
%~fI - Expand %I to a fully qualified pathname
%~dI - Expand %I to just a drive letter
%~pI - Expand %I to just a path
%~nI - Expand %I to just a file name
%~xI - Expand %I to just a file extension
%~sI - The expanded path contains only short names
%~aI - Expand %I to the file's file attributes
%~tI - Expand %I to the file's date/time
%~zI - Expand %I to the file's size
Floor 19 Posted 2006-10-28 02:58 ·  中国 广东 东莞 电信
初级用户
Credits 102
Posts 43
Joined 2006-09-07 05:22
19-year member
UID 62023
Status Offline
Learning!
Floor 20 Posted 2006-10-28 06:55 ·  中国 广东 电信
新手上路
Credits 13
Posts 7
Joined 2006-10-18 09:08
19-year member
UID 66284
Gender Male
Status Offline
Is there a tutorial for beginners? For those noobs who haven't come into contact with DOC yet
Floor 21 Posted 2006-10-30 07:10 ·  中国 黑龙江 绥化 电信
新手上路
Credits 6
Posts 3
Joined 2006-10-28 11:45
19-year member
UID 68660
Gender Male
Status Offline
Great stuff! Exactly what I need!!!
Floor 22 Posted 2006-11-16 04:27 ·  中国 江苏 宿迁 电信
初级用户
Credits 37
Posts 22
Joined 2006-11-11 21:44
19-year member
UID 70242
Gender Male
Status Offline
Thanks for sharing!!!!! Hehe
Floor 23 Posted 2006-11-16 13:39 ·  中国 安徽 合肥 电信
新手上路
Credits 2
Posts 1
Joined 2006-10-21 23:24
19-year member
UID 67587
Gender Male
From adfadf
Status Offline
Collect and learn slowly.
Floor 24 Posted 2006-11-17 06:28
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
%n, %%i, %i and other variables can all be used with these extended methods. And they can be combined. For example:

%~nx0 can list the full name of the file, including the extension.
%%~ftzaI looks like what we get when we execute DIR.

In addition: You can also check if a file exists. For example:
If the content of %1 is "aaa.txt"
Then echo %~f$PATH:1 can search for the file "aaa.txt" in the directories set in the %PATH% environment variable. If found, it will display the fully qualified path name of the found file as specified here (f is specified). If not found, it returns an empty string.
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Forum Jump: