I'm trying to create a batch file that renames files inside a folder. Each one has the same naming format: `car error file (1).txt`.

How can I remove the spaces from the title? I have to replace all spaces, tab and similars chars from each file and replace them with a jolly char (`|`) so I can take a string from each of the files.

The error that I have is that the batch file tries to find the file with only the name `car` and obviously it doesn't exist.

The `old` name doesn't need to be saved for after, so they can all be called car1, car2 and so on.

```
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

SET dir=C:\Users\betacom\Desktop\file\pat\SEMPREALAMENTARSEOH\

echo.>Output.csv

for /f %%f in ('dir /b %dir%*.txt') do (
    ::rename %%f "something.txt"
)

for /f %%f in ('dir /b %dir%*.txt') do (
    for /f "delims=" %%a in ('findstr \.edi %dir%%%f') do echo(%%a;;%%f)>>Output.csv

::after this row above will be:
    REM for /f "tokens=2 delims=|" %%a in ('findstr \.edi %dir%%%f') do echo(%%a;;%%f)>>%dir%Output.csv

)

```

current file names:

> 
> car error file (1).txt  
> 
>  car error file (2).txt
>  ...
> 
> 
> 

what I need them to be:

> 
> car1.txt  
> 
>  car2.txt
>  ...
> 
> 
>