通过批处理文件自动重命名csv文件

通过批处理文件自动重命名csv文件,csv,batch-file,Csv,Batch File,我尝试“自动”重命名我的csv文件(名为 (例如)通过批处理文件将´Trendreporting-10.csv´转换为´Trendreporting.csv´)保存在特定文件夹中。 为了更清楚,我想改变这一点: Trendreporting - 10.csv ( the part behind the - is variable: (so e.g. also Trendreporting - 07.csv) but there´s always only 1 csv file in the fo

我尝试“自动”重命名我的csv文件(名为
(例如)通过批处理文件将´Trendreporting-10.csv´转换为´Trendreporting.csv´)保存在特定文件夹中。 为了更清楚,我想改变这一点:

Trendreporting - 10.csv ( the part behind the - is variable: (so e.g. also Trendreporting - 07.csv) but there´s always only 1 csv file in the folder at a time)
为此:

Trendreporting.csv
我已经用这个查询尝试过了:

 @echo off
 setlocal enableDelayedExpansion
 for %%A in (TrendReporting - *.csv) do (
  set "name=%%A"
  ren TrendReporting - *.csv **
)
但是当我执行文件时,什么也没有发生——错误在哪里

@echo off
setlocal
ren "TrendReporting - *.csv" "Trendreporting.csv"
包含空格的名称必须用引号括起来,否则为可选

您不需要
延迟扩展
,也不需要为设置
,也不需要无意义地设置
名称