0

I have a script that I am writing and I am stuck..... My script lists all of the profiles in the C:\Users folder then exports the list to a text file and the output looks like this:

USER1
USER2
USER3
USER4

I thought I knew enough to make a quick line in the script that will read the file and assign each a variable Ex:

%User1%
%User2%

and so on for everyone in the list.

I use this to get the users from the display:

for /f "tokens=5" %%a in (C:\Temp\folders.txt) do set word3=%%a > "C:\Temp\Test.txt"
pause

But not sure how to get the %User1% to >>C:\Temp\Users.txt It comes out blank.

Any help would be appreciated

Magoo
  • 77,302
  • 8
  • 62
  • 84
doheth
  • 87
  • 9
  • What have you managed to write yourself, since receiving advice and solutions to [your almost similar question](https://stackoverflow.com/q/66390891/6738015), more than a week ago? – Compo Mar 06 '21 at 21:15

1 Answers1

0

Given the apparent format of the first text file, you could set the values of user* using

FOR /f "tokens=1*delims=[]" %%b IN ('FIND /n /v "" "%filename1%"') DO SET "user%%b=%%c"
SET user

Sadly, I can't decipher what you are attempting to do with the for...%%a... line.

Magoo
  • 77,302
  • 8
  • 62
  • 84