我正在尝试创建一个批处理脚本:
例如:我的文件夹中有名为Picture.JPG和Picture2.JPG的文件。该批处理需要复制文件名“Picture”和“Picture2”并将其粘贴到textfile.txt中,其中已经有我不想覆盖的最后一行,因此它会显示如下:
Picture
Picture2
This is the last line
Run Code Online (Sandbox Code Playgroud)
请注意,我不想复制 .JPG 扩展名。
有任何想法吗?
这应该可行,您需要将其放入 cmd.file 中
for %%a in (*.jpg) do echo %%~na >> Tem.txt
type textfile.txt >> tem.txt
copy tem.txt textfile.txt
del tem.txt
Run Code Online (Sandbox Code Playgroud)