我是脚本的新手,因此我需要一些帮助。我搜索了两天,无法掌握这一点!

我正在做的是扫描目录中的特定文件,然后计算结果并将其管道传输到文件。

dir *.DONE | find "04338" /c >>04338.txt

因此结果如下所示:
14
14
(blank line for carriage return)

My application is trying to read this file and run commands against it using RegEx. That part works fine except the application does not assign variables using multi-line match properly... it will grab the data fine but I cannot output it properly.

Because of this I have to write all of the data to one line. Eventually I want it to look like this:

14,14,14,14,14,14,14

我一生无法解决如何将其整合到一条线上的问题。请帮忙!

最佳答案

试试这个:

@echo off
for /f "delims=" %%a in ('dir /b /a-d *.DONE ^| find "04338" /c') do <nul set/p "=%%a,">>4338.txt
type 4338.txt

在行尾删除一个,

09-04 18:18