The remote part is not the issue it is testing the variables that were just created.
As an example when I run the batch file you created above I get:
userVar1=Administrator
userVar4=All Users
userVar5=Default User
userVar6=LocalService
userVar7=NetworkService
userVar8=setup
userVar9=mainuser1
userVar10=mainuser2
userVar11=mainuser3
Press any key to continue . . .
What I would like to do is test these variables to weed out everything except "userVar9" or "mainuser1" ; "userVar10" or "mainuser2" ; "userVar11" or "mainuser3".
I could have three users as in this example or 100. I want to run a specific task for each user but not the admin and setup users.
Dynamically assigned environmental variables
Moderator: DosItHelp
Re: Dynamically assigned environmental variables
You could write something like a black list:
blacklist.txt
This is case sensitive.
Now you could use this:
Regards
aGerman
blacklist.txt
Code: Select all
Administrator
All Users
Default User
LocalService
NetworkService
setup
This is case sensitive.
Now you could use this:
Code: Select all
@echo off &setlocal
pushd "C:\Documents and Settings"
for /f "delims=: tokens=1*" %%a in ('dir /ad /b^|findstr /v /x /g:"%~dp0blacklist.txt"^|findstr /n .') do set "userVar%%a=%%b"
popd
:: display all
set userVar
pause
Regards
aGerman