1.

Solve : Batch File for Deleting everything in c:\Documents and Settings Folder?

Answer»

Hi,

Please help in creating a batch file that will delete everything in c:\Documents and Settings Folder including the Default User folder which is hidden but not the Administrator and All user folder.

Thanks!Why do you want to delete everything in C:\Documents?
Do you mean C:\Documents and settings?

WHY?yes, i want to delete every folder with a 6 character name and the Default User folder inside C:\Documents and Settings Please answer my question. Why do you want to do this? Doing this to someone's computer will mess it up. WHOS computer are you victimizing? im not victimizing anyone's computer, i need this batchfile for my job. i need the documents and settings folder fresh everyday so that when users log in they will be able to load they settings. this has been an issue with our network.please helpRead this.... and if you proceed do so after lots of backup and with extreme caution, you may totally screw your ability for anyone to boot/logon.

All care - no responsibility.



Quote from: killian49 on June 21, 2007, 08:24:51 AM

im not victimizing anyone's computer, i need this batchfile for my job. i need the documents and settings folder fresh everyday so that when users log in they will be able to load they settings. this has been an issue with our network.

This does not make sense...why would the user's need an empty D&S folder to load their settings ? ?

I don't think we're getting the complete story.I'm with everyone else. I would strongly advise doing this. If you absolutely must do something like this, I'm sure there are better and safer methods.If this is a practical joke of some sort, don't do it because it's not funny.
A lot of important files are kept there. Deleting it could render the computer unusable.
Don't do this for jokes or games or because you're pissed at someone.If this network of yours consists of shared computers or computers for public use, check out SteadyState.

Otherwise I'm with the other posters. Not only is the Documents and Settings folder critical for the operation of Windows but deleting it's subfolders will break important links with the registry.

you dont understand guys. the users who logs in our network have MANDATORY PROFILES w/c is downloaded from a server to the local machine. everytime they log in, they leave a user folder in the Documents and Settings. SOMETIMES when they login to that same machine the MANDATORY PROFILE doesn't load correctly that's why we need to delete the user folder from the previous login.

BTW, i need to leave the Administrator, All Users and other hidden system folders there. I just need to delete the user folders which are 6 characters long.But if you delete c:\documents and settings, you delete the administrator account too....Microsoft has this to say: "Profile management should be done preferentially by policy. Mandatory profile use, although permitted, is less manageable and more prone to create administration problems, thus it is not recommended"

Quote
Sometimes when they login to that same machine the MANDATORY PROFILE doesn't load correctly that's why we need to delete the user folder from the previous login

Perhaps you should try troubleshooting why the profiles don't load correctly instead of taking a hatchet to the profile folders.

Batch code could do this, but will probably have problems with the six character profile name restriction. VBScript could handle the name length restriction and also has a hook to Active Directory.

SteadyState was not helpful?


To take care of the 6 character part, couldn't you just use the ? wild card 6, 5, 4, 3, 2, and 1 times?

Code: [Select]del ??????.*
del ?????.*
del ????.*
del ???.*
del ??.*
del ?.*
Just an idea, or maybe I'm missing the point (which is only GOOD if someone is trying to stab you or shoot you with a sharp PROJECTILE ).


Discussion

No Comment Found