执行命令输出到多行

时间:2019-06-27 12:51:18

标签: for-loop cmd

我正在尝试从。exe执行命令,但是它输出到很多行...

for %b in ("AB","FG") do (for /D %a in ("C:\FileStore\%~b*") do (echo %~fa))

输出:

C:\Users\admin>(for / %a in ("C:\FileStore\AB*") do (echo %~fa ) )
C:\Users\admin>(echo C:\FileStore\AB Map 1 )
C:\FileStore\AB Map 1

C:\Users\admin>(for / %a in ("C:\FileStore\FG*") do (echo %~fa ) )

C:\Users\admin>(echo C:\FileStore\FG Map 2 )
C:\FileStore\FG Map 2

但是我只想要这个...

C:\FileStore\AB Map 1
C:\FileStore\FG Map 2

我该如何解决?

使用进行此操作效果很好,但是我需要从运行它。

1 个答案:

答案 0 :(得分:2)

要禁用命令的隐式回显,请在命令前加上 Select * from ( SELECT dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptlc.Value),'N')) AS [Planned] ,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptlc.Value)),'N')) AS [To Be Planned] ,dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptla.Value),'N')) AS [Actual] ,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptla.Value)),'N')) AS [Remaining] from XPV.MyFIlterView d1 ) as FilteredView ORDER BY cast(replace(3,'$','') as float)

@

请注意,该行上的每个命令都需要自己的沉默前缀。