Well... I try to dabble in batch as little as possible, and I'm mainly a C/C#/C++ man. My problem is that my script does two nested FOR loops where I run through the 'Users' folder first and snag the user names and then through other folders:
set BaseDir=%CD%
cd C:\Users
for /F %%I in ('DIR *.* /B /O:-D') do (
set UserName=%%I
echo %UserName%
)
cd %BaseDir%
This roughly demonstrates the problem. Maybe it's my C++ style formatting? Maybe I'm dumb when it comes to batch? Assuming I have 3 users on my system (Admin, User1, User2; in that order) this will print:
Admin
Admin
Admin
Totes wrong. If one were to call echo on %%I everything would go according to plan:
Admin
User1
User2
Am I missing something here as far as variables go, or what's the deal? DOS doesn't like variable re-assignment? Thnx in advance. (specs: Windows 7, notepad, cmd as admin)