I'm trying to build out a script that will pull the list of users, grab each of their names and then do a directory list for each of their appdata folders.
So far I'm thinking that I could just use the net user > C:\userlist.txt
to create the list of users, my real problem comes in grabbing the user's names and putting them into the next command.
By using a variable of some kind I would like to have findstr pull in each user so that I could get a list of all the users's directories.
The end result would look something like this:
dir C:\users\$variableforusers\AppData\Roaming > C:\directorylist.txt
I'd like to be able to get this command to run for each users appdata directory, so this command would need to repeat itself based on how many users the end machine has.
This will be running from the local system account so %appdata% will not work as it only gives you the currently logged in user's appdata folder.
If possible, I'd like for the directory list to all be dumped into one file, otherwise I'd have to introduce a variable to check multiple files for the results.
Thanks ahead of time for the help guys!