Home > Net >  Batch file only run once, FOR loop at fault
Batch file only run once, FOR loop at fault

Time:10-30

I'm looking for a batch that look into folders that begins with "@" and then inside those folders have a subfolder named "Keys" copy a file.bikey to a static folder name "keys".

The for /d loop that I use apparently stops working due to a cd/goto commands inside.

Main
│   key-collector.bat
│
├───@folder_a
│   └───keys
│           a.txt
│
├───@folder_b
│   └───keys
│           b.txt
│
├───@folder_c
│   └───keys
│           c.txt
└───keys
    └───(Destination)

Current code:

@echo off
:start
set modsPath="C:\Exemple"
set keysPath="%modsPath%\keys"
for /d %%i in (@*) do (
    echo %%i
    copy /y            
  • Related