我是一个真正的“新手”,并编写了以下脚本:
chdir C:\Users\oRookie\Desktop\batch
dir /b *txt > out.txt
文件out.txt
已创建并包含out.txt
。
到目前为止,让我们尝试进一步发展。现在,我希望它的内容仅仅out
是。因此,我需要某种方法来删除输出中的文件扩展名,但又不删除文件扩展名本身。我该怎么做?
提前致谢。
尝试一下此代码,让我知道这是否在寻找什么?
@echo off
Set Location=%userprofile%\Desktop\
Set Log=out.txt
if exist %Log% del %Log%
for /f %%i in ('dir /b /a-d %Location%*.txt') do @echo %%~ni >> %Log%
start "" %Log%
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句