1

I trying to concatenate c files path and the name of the file in one variable . I already try this code

@echo off
set "repository_path=C:\path\to\repository"  REM Replace with the actual path to your repository
set "file_names="

for /r "%repository_path%" %%F in (*.c) do (
    set "file_name=%%F"
    set "file_names=!file_names! !file_name!"
)

echo All C file names: %file_names%

but the output i have is All C file names: !file_names! !file_name! instead of All C file names: path/file1.c path/file2.c path/file3.c ... path/fileN.c

Ptns
  • 11
  • 2
  • 1
    After the `@echo off` line you need another line, `setlocal enabledelayedexpansion` wich invokes the `delayedexpansion` mode. [Variables are not behaving as expected](https://stackoverflow.com/questions/30282784/variables-are-not-behaving-as-expected) – Magoo Jun 21 '23 at 12:28
  • Hello, Thank you that working – Ptns Jun 22 '23 at 08:25

0 Answers0