|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
楼主的错误到底是怎么回事那?以前看到过那样的错误
What exactly is the problem with the building's error? I saw that kind of error before.
|
|
2006-9-27 09:55 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
Originally posted by namejm at 2006-9-27 09:53:
从这段代码来看,你是在CMD窗口下执行的。从你的整体意思来看,你是想先转到 C 盘根目录下之后再创建文件夹,但是你最开始的那一句就没冠...
我怎么执行没有错误那???不解
Originally posted by namejm at 2006-9-27 09:53:
From this code, it seems you are executing in the CMD window. Judging from your overall meaning, you want to first switch to the root directory of drive C and then create a folder, but the first sentence you started with didn't have...
Why do I get no errors when I execute it??? Confused
|
|
2006-9-27 09:57 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
其实for扩充到文件名还是有BUG的:
for语句中执行dir /ad或dir /a-d中用%%~ni扩充到文件名, FOR语句处理机制可能是把最后一个路径"\"符号后面"."号和后面的后缀去掉, 只显示文件名;
而如果/ad只查找文件夹, 最后的路径"/"后面没有"."号, 它会整个显示最后一个目录名.
Last edited by pengfei on 2006-9-27 at 12:10 ]
In fact, there are still bugs when the for is extended to file names:
In the for statement, when executing dir /ad or dir /a-d and using %%~ni to extend to the file name, the FOR statement processing mechanism may be to remove the "." after the last path "\" symbol and the following suffix, and only display the file name;
And if /ad only searches for folders, and there is no "." after the last path "/", it will display the entire last directory name.
Last edited by pengfei on 2006-9-27 at 12:10 ]
|
|
2006-9-27 09:59 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
Originally posted by he200377 at 2006-9-27 09:57:
我怎么执行没有错误那???不解
你那段代码第一个命令是存在缺陷的, 假设你在D盘运行...
不过for语句的%%~ni扩充的确是有bug的, 当时我也没有测试. 后来才发现他的扩充机制存在问题.
Last edited by pengfei on 2006-9-27 at 10:24 ]
Originally posted by he200377 at 2006-9-27 09:57:
Why is there no error when I execute it??? puzzled
There is a flaw in the first command of your code. Suppose you run it on drive D...
But the expansion of %%~ni in the for statement does have a bug. I didn't test it at that time. Later I found that there was a problem with its expansion mechanism.
Last edited by pengfei on 2006-9-27 at 10:24 ]
|
|
2006-9-27 10:04 |
|
|
smileseeker
中级用户
  
积分 316
发帖 83
注册 2005-3-1
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
感谢各位朋友的热心帮助
小弟的目的是这样的 通过下面代码
echo.>temp.txt
for /f %%i in ('dir /ad /s /b') do (echo %%~ni|findstr "^*$" && echo %%i >>temp.txt)
for /f %%i in (temp.txt) do del /q %%i\*.*
解决 http://www.cn-dos.net/forum/viewthread.php?tid=23404&fpage=1
但是就是卡在findstr上
Last edited by smileseeker on 2006-9-28 at 05:08 ]
Thanks to the enthusiastic help of all friends
The purpose of the younger brother is like this. Through the following code
echo.>temp.txt
for /f %%i in ('dir /ad /s /b') do (echo %%~ni|findstr "^*$" && echo %%i >>temp.txt)
for /f %%i in (temp.txt) do del /q %%i\*.*
Solve http://www.cn-dos.net/forum/viewthread.php?tid=23404&fpage=1
But it is stuck on findstr
|
|
2006-9-28 04:06 |
|
|
smileseeker
中级用户
  
积分 316
发帖 83
注册 2005-3-1
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
Originally posted by namejm at 2006-9-27 09:44 AM:
此言差矣。CMD下的 dir 是可以区分出某个file到底是文件夹还是文件的,要不然,dir命令还要 /ad 和 /a-d 这两个参数干什么呢?如果按照你的理解 ...
同意
D:\scripts>for /f %i in ("\123.456") do echo %~ni
D:\scripts>echo 123
123
Originally posted by namejm at 2006-9-27 09:44 AM:
This statement is incorrect. The 'dir' command under CMD can distinguish whether a file is a folder or a file. Otherwise, why are there the two parameters /ad and /a-d for the 'dir' command? If according to your understanding...
Agreed
D:\scripts>for /f %i in ("\123.456") do echo %~ni
D:\scripts>echo 123
123
|
|
2006-9-28 04:14 |
|
|
smileseeker
中级用户
  
积分 316
发帖 83
注册 2005-3-1
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
这是我以前在论坛上找的一段批处理脚本
set /p aa=Enter your code:
echo %aa% | findstr "^[a-z][A-Z]*$"||echo ERROR!!!
pause
我记得当时好像是可以执行的 现在居然是这样的执行结果
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^[a-z][A-Z]*$" || echo ERROR!!!
无语
This is a batch script I found on the forum before
set /p aa=Enter your code:
echo %aa% | findstr "^*$"||echo ERROR!!!
pause
I remember it seemed to be executable at that time. Now it's actually such an execution result
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
D:\scripts>set /p aa=Enter your code:
Enter your code:
D:\scripts>echo dfg | findstr "^*$" || echo ERROR!!!
Speechless
|
|
2006-9-28 04:24 |
|
|
kgdetg1127
初级用户
 
积分 158
发帖 89
注册 2007-4-25
状态 离线
|
|
2007-10-11 21:25 |
|