Hi, I'm trying to create a batch file script to save all the folders within C:\Users that contain student name in a variable, I managed to get to the point where I return the folder name but I couldn't save the name of more than a folder in the same variable.
EX: C:\Usuários\Aluno1
C:\Usuários\Aluno2
C:\Usuários\Aluno3
C:\Usuários\Aluno4
I would like the variable to return
profile_delete=Student1 Student2 Student3 Student4
for /f %%a in ('"dir /b C:\Users |findstr /i aluno"') do (
echo %%a
pause
)
Could someone help me?
set variable multiple value [SOLVED]
Moderator: DosItHelp
-
- Posts: 14
- Joined: 26 Oct 2017 11:30
set variable multiple value [SOLVED]
Last edited by deniscalanca on 25 Jun 2024 08:09, edited 1 time in total.
Re: set variable multiple value
Code: Select all
@echo off
setlocal enabledelayedexpansion
set "profile_delete="
for /f "delims=" %%a in ('dir /b C:\Users ^|findstr /i aluno') do (
set "profile_delete=%%a !profile_delete!"
)
echo %profile_delete%
-
- Posts: 14
- Joined: 26 Oct 2017 11:30
Re: set variable multiple value
thank you very much