|
sqn
新手上路

积分 12
发帖 2
注册 2006-5-28
状态 离线
|
『楼 主』:
请问用for+del 命令如何删除路径中有空格的文件
使用 LLM 解释/回答一下
用命令
for /r "C:\Documents and Settings\enc\My Documents" %%1 in (*.log *.tmp) do del %%1
运行时却出错:
系统找不到指定的路径
另外,文件名中有空格的也不能删除(聪明的 xp 将其识别为 n 部分)
why
When running the command `for /r "C:\Documents and Settings\enc\My Documents" %%1 in (*.log *.tmp) do del %%1`, an error occurs: The system cannot find the specified path. In addition, files with spaces in the file name cannot be deleted either (clever XP recognizes it as n parts). why
|
|
2006-5-31 19:36 |
|
|
fujianabc
金牌会员
     
积分 3467
发帖 1616
注册 2004-6-21
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
%1是指短文件名,长文件名是"%l",带引号就解决了文件名带空格的问题。
另外,普通命令中用一个百分号,放批处理中则用两个百分号。
%1 refers to the short file name, and the long file name is "%l". Using quotes solves the problem of file names with spaces.
In addition, a single percent sign is used in ordinary commands, while two percent signs are used in batch processing.
|
|
2006-5-31 20:18 |
|
|
chineselgs
高级用户
    论坛灌水专业户
积分 613
发帖 266
注册 2006-4-19 来自 河南省
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
楼上说的好象很不好用
What the person above said seems to be not very useful
|

饮马恒河畔,剑指天山西,碎叶城揽月,库叶岛赏雪,黑海之滨垂钓,贝尔加湖面张弓;中南半岛访古,东京废墟祭祖!
|
|
2006-6-4 16:26 |
|
|
ily2013
中级用户
  
积分 247
发帖 83
注册 2005-9-12
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我也有类似的问题,用for对临时文件操作时不成功!
I also have a similar problem, and it didn't succeed when operating temporary files with for!
|
|
2006-6-4 16:44 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-6-4 22:20 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
在没;命令里输入:
for /r "C:\Documents and Settings\enc\My Documents" %1 in (*.log *.tmp) do del "%1"
在批处理里输入:
for /r "C:\Documents and Settings\fff\My Documents" %%1 in (*.log *.tmp) do del “%%1”
In the non-command line input:
for /r "C:\Documents and Settings\enc\My Documents" %1 in (*.log *.tmp) do del "%1"
In the batch file input:
for /r "C:\Documents and Settings\fff\My Documents" %%1 in (*.log *.tmp) do del “%%1”
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-6-4 22:43 |
|
|
fujianabc
金牌会员
     
积分 3467
发帖 1616
注册 2004-6-21
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
注意2楼写的,是l(小写字母) 不是1(数字)。
Note that in the second floor it's l (lowercase letter), not 1 (digit).
|
|
2006-6-5 11:09 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-6-5 11:15 |
|
|
ily2013
中级用户
  
积分 247
发帖 83
注册 2005-9-12
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
6楼正确!
再问一个:
想在搜索到的文件里找到某个文件而不是删除操作!
比如在C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\下搜索文件大于20kb的文件,或某个特定时间的!
6th floor is correct!
Another question:
I want to find a certain file among the searched files instead of performing a delete operation!
For example, search for files larger than 20kb in the C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\ directory, or files of a specific time!
|
|
2006-6-5 20:53 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
楼上可以试试这个来判断文件大小
@echo off
setlocal enabledelayedexpansion
set a=
for /r "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" %%i in (*.*) do if %%~zi GTR 20480 set a=%%i !a!
echo 大于20K的文件有 %a%
而对于时间来说,只能得到文件的修改时间
You can try this upstairs to judge the file size
@echo off
setlocal enabledelayedexpansion
set a=
for /r "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" %%i in (*.*) do if %%~zi GTR 20480 set a=%%i !a!
echo The files larger than 20K are %a%
And for time, only the modification time of the file can be obtained
|
|
2006-6-6 08:53 |
|
|
gwlok
中级用户
   DOS爱好者
积分 213
发帖 99
注册 2006-3-26
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
学习了我今才知道还有这个命令,我以前只知道 Rd del 这两个删除命令
I just learned today that there is still this command. I only knew the two delete commands Rd and del before
|
|
2006-6-9 09:35 |
|
|
ily2013
中级用户
  
积分 247
发帖 83
注册 2005-9-12
状态 离线
|
|
2006-6-9 21:13 |
|
|
lyaa
初级用户
 
积分 40
发帖 17
注册 2007-8-10
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by bagpipe at 2006-6-6 08:53 AM:
楼上可以试试这个来判断文件大小
@echo off
setlocal enabledelayedexpansion
set a=
for /r "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" ...
怎样同时显示隐藏文件??
How to display hidden files at the same time?
|
|
2007-9-14 09:53 |
|
|
ThinKing
中级用户
  
积分 471
发帖 207
注册 2007-5-3
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
For /R 无法遍历出隐藏文件。
For /R cannot traverse hidden files.
|
|
2007-9-14 10:22 |
|
|
kgdetg1127
初级用户
 
积分 158
发帖 89
注册 2007-4-25
状态 离线
|
|
2007-10-4 15:40 |
|