`Felix` Posted September 7, 2004 Share Posted September 7, 2004 Hi there all,It has been many years since i had to write anything serious in a batch file and for the life of my can't remember the right syntax for what i am tring to do - if you can help me out i would appreciate it. I want to search the \documents and settings for certain folder (user profile) names for exampleFOR %%p IN (%userprofilesdir%) DO IF EXIST %%p\xyx | %%p\xyz SET theprofile=%%pecho %theprofile%Once i get a true, i want to then do some copying of stuff to these specific profiles.Cheers,Felix Link to comment Share on other sites More sharing options...
`Felix` Posted September 7, 2004 Author Share Posted September 7, 2004 Ok i worked it out myself but for those of you that are interested here is my solution.@echo off:checkcd %allusersprofile%cd ..set userprofilesdir=%cd%FOR %%d IN ("%userprofilesdir%") DO IF NOT EXIST %%d\xyz* GOTO false clsecho it is heregoto end:falseclsecho not heregoto end:endNow you may be wondering why I was looking for this solution? - I have had need to do some unattended installs to system that have had a copy of windows on them already prevously and I automatically delete the \windows directory during the isntallation, however the nice thing is that the documents and settings folder is left intact. Now what happens is that after you install and logon as one of the same users that was previously configured before the upgrade, you end up with a user profile folder for example: \documents and settings\xyz.domain\ becasue the folder \documents and settings\xyz\ already existed.This is fine and of course all of user XYZ's configuration (\documents and settings\xyz\)is intact, but it is in the wrong folder... so with the above script, I can search to see if it is there and then have some commands to copy the original settings etc to the new location, or better still change the registery to point to the original location. Stay tuned for a step by step guide to do this whole thing. Oh and why would i want to upgrade system that is already installed with Windows XP? Well from experience and more recently with SP2 updates - the system can become very bloated and or unstable. A clean installation is my preference everytime.let me know your thoughts on this... and if you have any ideas to contribute - feel free. Felix Link to comment Share on other sites More sharing options...
sleepnmojo Posted September 7, 2004 Share Posted September 7, 2004 Nice job. I do something similar in my unattended, but it is only for Default, and all users that I do. I get around this with variables.%ALLUSERSPROFILE% will return for all users, and I set up the %DEFAULTUSERPROFILE% during setup for the default. Then I will extract the files to the proper locations, rather than store them in folders in my $DOCS folder. Saves a lot of headaches. 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