SLipEdd Posted January 15, 2005 Share Posted January 15, 2005 hiI'm using my unattended installation to install new computerswith this, useraccounts.cmd is read from the floppyevery computer has different user accounts.. so There are some icons I want to remove from the quick launch menu, desktop or start-menubut I want to do this with an batchfileIs there a variable or key, so icons can be removed from every account? (and not in the AllUsers!)tnx Link to comment Share on other sites More sharing options...
Cartoonite Posted January 15, 2005 Share Posted January 15, 2005 There isn't a variable or key that I know of, but you should still be able to do it with a fairly simple script. Create an additional file on your floppy called Users.txt. Put a list of users in it, one per line, as such:Users.txtUser1User2User3User4Then use a simple for loop to do each of the required deletions like so:FOR /f %%f in ('type a:\users.txt') DO (del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk")This example should delete the Sample Pictures from every user's My Pictures folder. Use of %allusersprofile%\.. ensures that the command will target the proper file regardless of whether or not the Documents and Settings folder has been moved from its default spot on the system drive. Otherwise, %systemdrive%\Documents and Settings\%%f\... can also be used.Hope this is clear, since I'm writting it after being awake almost 24 straight hours. I'm heading to bed as soon as this is posted. Link to comment Share on other sites More sharing options...
SLipEdd Posted January 17, 2005 Author Share Posted January 17, 2005 There isn't a variable or key that I know of, but you should still be able to do it with a fairly simple script. Create an additional file on your floppy called Users.txt. Put a list of users in it, one per line, as such:User1User2User3User4Then use a simple for loop to do each of the required deletions like so:FOR /f %%f in ('type a:\users.txt') DO (del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk")This example should delete the Sample Pictures from every user's My Pictures folder. Use of %allusersprofile%\.. ensures that the command will target the proper file regardless of whether or not the Documents and Settings folder has been moved from its default spot on the system drive. Otherwise, %systemdrive%\Documents and Settings\%%f\... can also be used.Hope this is clear, since I'm writting it after being awake almost 24 straight hours. I'm heading to bed as soon as this is posted. hmm that a good way but can't I make a file, so he'll take every account? no matter what name it is?I'll be glad to hear it, because there are a lot of last names here in Holland Link to comment Share on other sites More sharing options...
Cartoonite Posted January 18, 2005 Share Posted January 18, 2005 You could try this. Essentially the same for loop, just taking the input from a different location.FOR /f "tokens=*" %%f in ('dir /ad /b "%allusersprofile%\.."') DO (del "%allusersprofile%\..\%%f\My Documents\My Pictures\Sample Pictures.lnk")Since I assume you have to manually create the useraccounts.cmd file to be placed on the floppy, you could replace that script with a user.txt file and then create a single useraccounts.cmd that would then sit on the uA CD itself.Users.txtUser1 password groupUser2 password groupUser3 password groupUser4 password groupUseraccounts.cmd(on CD)if exist A:\Users.txt (for /f "tokens=2,3,4*" %%f in ('type A:\Users.txt') do (net user %%f %%g /addnet localgroup %%h %%f /add))You can then call the delete script using the same Users.txt file as coded in my first post. If you are using custom groups for your setup, you can create those from a text file with a for loop on your uA CD too.Groups.txtGroup1 commentGroup2 commentGroup3 commentGroup4 commentAddGroups.cmd(on CD)if exist A:\Groups.txt (for /f "tokens=2*" %%f in ('type A:\Groups.txt') do (net localgroup %%f /COMMENT:"%%g" /add))The only downside I can see to doing it this way is that you can't create users or groups with spaces in them. Then again, I don't really see why you would want to anyway. Link to comment Share on other sites More sharing options...
Cartoonite Posted January 22, 2005 Share Posted January 22, 2005 Did you ever get this working, SLipEdd? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now