`Felix` Posted February 21, 2005 Share Posted February 21, 2005 Hi guy'sNow i know that this area is mainly for programming and i will starting to do some vb, however i need a quick batch/cmd to do the following.I have a list of directories that may vary in name a little... basically they are duplicateeg. c:\documents and settings\default userc:\documents and settings\default user.windowsc:\documents and settings\default user.windows.000c:\documents and settings\default user.windows.001c:\documents and settings\default user~windowsc:\documents and settings\all usersc:\documents and settings\all users.windowsc:\documents and settings\all users.windows.000c:\documents and settings\all users.windows.001Now i want to able to search the c:\documents and settings directory and if any of these directories other than the base like "default user" is there that i use the rd command and remove them. so in the example above i would be removing:c:\documents and settings\default user.windowsc:\documents and settings\default user.windows.000c:\documents and settings\default user.windows.001c:\documents and settings\default user~windowsnotc:\documents and settings\default userdoes that make sense? I would appreciate any help or advise.... thanks in advance. Link to comment Share on other sites More sharing options...
jaclaz Posted February 21, 2005 Share Posted February 21, 2005 What if you just run RMDIR "c:\documents and settings\default user?w*" /S /QRMDIR "c:\documents and settings\all users?w*" /S /QType RD /? or RMDIR /? at the command prompt for the meaning of the switches.To test if you get the right directories, type:DIR "c:\documents and settings\default user?w*"and DIR "c:\documents and settings\all users?w*"BEFORE trying to use the RMDIR command!jaclazP.S.: you need the quotes around the path as it contains spaces Link to comment Share on other sites More sharing options...
dman Posted February 21, 2005 Share Posted February 21, 2005 Make sure you know which ones you are deleting first! You usually get a structure like this by installing windows several times without deleting the old dirs."\default user.windows.001" may very well be your active default user directory, not "\default user" Link to comment Share on other sites More sharing options...
`Felix` Posted February 22, 2005 Author Share Posted February 22, 2005 Make sure you know which ones you are deleting first! You usually get a structure like this by installing windows several times without deleting the old dirs."\default user.windows.001" may very well be your active default user directory, not "\default user"<{POST_SNAPBACK}>Thanks for the advise - yes i know this, but it is worth mentioning... I have checked and am deleting those not in use.Thanks again Link to comment Share on other sites More sharing options...
`Felix` Posted February 22, 2005 Author Share Posted February 22, 2005 What if you just run RMDIR "c:\documents and settings\default user?w*" /S /QRMDIR "c:\documents and settings\all users?w*" /S /QType RD /? or RMDIR /? at the command prompt for the meaning of the switches.To test if you get the right directories, type:DIR "c:\documents and settings\default user?w*"and DIR "c:\documents and settings\all users?w*"BEFORE trying to use the RMDIR command!jaclazP.S.: you need the quotes around the path as it contains spaces<{POST_SNAPBACK}>hi jaclaz,Thanks for the information - you got me on the right track...DIR "c:\documents and settings\all users?w*" doesn't work, however DIR "c:\documents and settings\all users.w*" does - so that i can live with, however i can't use RD with this... i get the following error "The filename, directory name, or volume label syntax is incorrect." Any other suggestions on how i might do this? Link to comment Share on other sites More sharing options...
jaclaz Posted February 22, 2005 Share Posted February 22, 2005 I am sorry, it looks like I went to fast,RMDIR does not support wildcards, see here:http://www.ss64.com/nt/rd.htmlSo you need to write a batch file after all.I'll try and make one and post it here a.s.a.p.jaclaz Link to comment Share on other sites More sharing options...
jaclaz Posted February 22, 2005 Share Posted February 22, 2005 Ok, I found this example on the wonderful Rob Vanderwoude's site:http://www.robvanderwoude.com/files/deldeadprofiles.txt@ECHO OFF:: DelDeadProfiles, Version 1.00 for Windows NT:: Removes unused leftovers of corrupted profiles for the current user ID.:: If the current user profile is C:\WINNT\Profiles\userid.000 then both:: C:\WINNT\Profiles\userid and C:\WINNT\Profiles\userid.002 will be:: removed.:: Written by Rob van der Woude:: http://www.robvanderwoude.comCALL :CheckIfCorrupt %userprofile%GOTO:EOF:CheckIfCorruptFOR /D %%A IN (%~dpn1.*) DO CALL :DelDeadProfiles %%A %userprofile%GOTO:EOF:DelDeadProfilesif not [%~f1]==[%~f2] echo Deleting corrupted profile %~nx1 . . .if not [%~f1]==[%~f2] rd /s /q %1goto:EOFFor the meaning of the variables expansions used see here:http://www.robvanderwoude.com/ntcall.htmlLet us adapt it to your need:@ECHO OFF:: DELUD.BAT:: DELete Unneded Directories:: a script by jaclaz:: based on script DeadProf.bat:: Written by Rob van der Woude:: http://www.robvanderwoude.comIf %1.==. GOTO :usageIf not %1=="%~1" GOTO :usage2CALL :CheckIfCorrupt %1GOTO:EOF:CheckIfCorrupt::dir "%~1*"FOR /D %%A IN ("%~1*") DO CALL :DelDeadProfiles "%%A" %1GOTO:EOF:DelDeadProfilesif not ["%~f1"]==["%~f2"] echo Deleting corrupted profile "%~nx1" . . .::IF the listing is correct, then remove the :: from the following line::if not ["%~f1"]==["%~f2"] rd /s /q %1GOTO:EOF:usageECHO You must supply a base directory nameGOTO:EOF:usage2ECHO ERROR!ECHO.ECHO Name supplied has spaces in itECHO If the path includes a space it MUST have QUOTES "" aroundECHO.ECHO This is what I understood:ECHO %1ECHO.ECHO This is (probably) what you meant:ECHO "%1 %2"GOTO:EOF(copy the above and paste it in notepad, saving it as delud.bat)jaclaz Link to comment Share on other sites More sharing options...
`Felix` Posted February 23, 2005 Author Share Posted February 23, 2005 Ok, I found this example on the wonderful Rob Vanderwoude's site:http://www.robvanderwoude.com/files/deldeadprofiles.txtLet us adapt it to your need:@ECHO OFF:: DELUD.BAT:: DELete Unneded Directories:: a script by jaclaz:: based on script DeadProf.bat:: Written by Rob van der Woude:: http://www.robvanderwoude.comIf %1.==. GOTO :usageIf not %1=="%~1" GOTO :usage2CALL :CheckIfCorrupt %1GOTO:EOF:CheckIfCorrupt::dir "%~1*"FOR /D %%A IN ("%~1*") DO CALL :DelDeadProfiles "%%A" %1GOTO:EOF:DelDeadProfilesif not ["%~f1"]==["%~f2"] echo Deleting corrupted profile "%~nx1" . . .::IF the listing is correct, then remove the :: from the following line::if not ["%~f1"]==["%~f2"] rd /s /q %1GOTO:EOF:usageECHO You must supply a base directory nameGOTO:EOF:usage2ECHO ERROR!ECHO.ECHO Name supplied has spaces in itECHO If the path includes a space it MUST have QUOTES "" aroundECHO.ECHO This is what I understood:ECHO %1ECHO.ECHO This is (probably) what you meant:ECHO "%1 %2"GOTO:EOF(copy the above and paste it in notepad, saving it as delud.bat)jaclaz<{POST_SNAPBACK}>Hi jaclaz,Thanks very much for your help - it put me on the right path and i have taken your adaptation and modified it further. Here is the finished result. @ECHO OFF:: DELUD.BAT:: DELete Unneded Directories:: a script by jaclaz:: Updated by `felix`:: based on script DeadProf.bat:: Written by Rob van der Woude:: http://www.robvanderwoude.comsetlocalset theNum=0set qry=reg query "hklm\software\microsoft\windows nt\currentversion\profilelist" /v ProfilesDirectoryset fnd1=FIND /I "Documents and Settings"set fnd2=FIND /I "ProfileImagePath"for /f "Tokens=1,2*" %%i in ('%qry%^|%fnd1%') do (set DocSetDir0="%%k\All Users.w*")for /f "Tokens=1,2*" %%i in ('%qry%^|%fnd1%') do (set DocSetDir1="%%k\Default User*")CALL :CheckIfDuplicate %DocSetDir0% %DocSetDir1%GOTO:EOF:CheckIfDuplicateFOR /D %%A IN ("%~1*") DO CALL :DelDuplicateProfiles "%%A" %1FOR /D %%A IN ("%~2*") DO CALL :DelDuplicateProfiles "%%A" %2GOTO:EOF:DelDuplicateProfilesset /a theNum=%theNum%+1reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v RemoveDuplicateProfile%theNum% /d "%comspec% /C RMDIR /S /Q ""%1""" /f >NULecho %theNum% Deleting corrupted profile "%~nx1" . . .endlocalOne question is there a better way for me to implement the :CHECKIF DUPLICATE section? Right now i am using 2 lines - is it possible to do it in a single line? Link to comment Share on other sites More sharing options...
jaclaz Posted February 23, 2005 Share Posted February 23, 2005 I'll have a look at it, it seems like a nice piece of work, but, on first glance, where is the "fnd2" variablereused? jaclaz Link to comment Share on other sites More sharing options...
Martin Zugec Posted February 23, 2005 Share Posted February 23, 2005 Well, if I understood what U want to do, why not just use simple line of code, e.g.for /f "usebackq delims= tokens=1,2" %%i IN (`dir /b "c:\documents and settings"`) DO IF /i "%%i" NEQ "default user" rmdir /s /q "c:\Documents and settings\%%i" ? Link to comment Share on other sites More sharing options...
`Felix` Posted February 23, 2005 Author Share Posted February 23, 2005 I'll have a look at it, it seems like a nice piece of work, but, on first glance, where is the "fnd2" variablereused? jaclaz<{POST_SNAPBACK}>Hi jaclaz,in the version you see here i haven't used fnd2, as it was not needed. I just left it in there incase i want to use it later... am still building on the script Also how do i address the fact that default user is hidden? When hidden it can not be found using this method Link to comment Share on other sites More sharing options...
`Felix` Posted February 23, 2005 Author Share Posted February 23, 2005 Well, if I understood what U want to do, why not just use simple line of code, e.g.for /f "usebackq delims= tokens=1,2" %%i IN (`dir /b "c:\documents and settings"`) DO IF /i "%%i" NEQ "default user" rmdir /s /q "c:\Documents and settings\%%i" ?<{POST_SNAPBACK}>Hi soulin,Thanks for the suggestion. I am actually doing a check against the registry and then deleting duplicates for a number of directories. in the earlier posts you are only seeing part of the final code as it is still a work in progress Link to comment Share on other sites More sharing options...
`Felix` Posted February 24, 2005 Author Share Posted February 24, 2005 Think i am almost there - just need to address the hidden directories... Link to comment Share on other sites More sharing options...
`Felix` Posted February 25, 2005 Author Share Posted February 25, 2005 Ok guy's here it is... i have been testing and tweaking for 3 days solid and i think i have the bugs out now, but would be interested in any feedback etc particularly any ways to streamline the code further.. if you want some background please look at This thread@ECHO OFF:: Fix and Delete Duplicate Profiles 1.1.9:: Copyright 2005. `felix`.:: Credits to jaclaz, soulin and all the great people from MSFN:: for there help and testing :)setlocalset theNum=0set KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileListset gtid=getsid \\%computername% %username% \\%computername% %username%for /f "Tokens=7" %%i in ('%gtid%^') do (set UserSID=%%i)set qry1=reg query "%KEY%" /v ProfilesDirectoryset qry2=reg query "%KEY%" /sset qry3=reg query "%KEY%\%USERSID%" /v ProfileImagePathset fnd1=FIND /I "Documents and Settings"set fnd2=FIND /I "ProfileImagePath"set fnd3=FIND /I "AllUsersProfile"set fnd4=FIND /I "DefaultUserProfile"set fnd5=FIND /I "LocalService"set fnd6=FIND /I "NetworkService"set fnd7=FIND /I "%UserName%"for /f "Tokens=1,2*" %%i in ('%qry1%^|%fnd1%') do (set DocSetDir0=%%k)for /f "Tokens=1,2*" %%i in ('%qry1%^|%fnd1%') do (set DocSetDir1="%%k\All Users")for /f "Tokens=1,2*" %%i in ('%qry1%^|%fnd1%') do (set DocSetDir2="%%k\Default User")for /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd5%') do (set DocSetDir3="%%k")for /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd6%') do (set DocSetDir4="%%k")for /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd7%') do (set DocSetDir5="%%k")CALL:CheckCurrentLocalCALL:CheckIfDuplicate1 %DocSetDir1% %DocSetDir2% %DocSetDir3% %DocSetDir4% %DocSetDir5%GOTO:EOF:CheckCurrentLocalFOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd3%') do if /i not "%%k"=="All Users" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v AllUsersProfile /d "All Users" /f >NUL )FOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd4%') do if /i not "%%k"=="Default User" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v DefaultUserProfile /d "Default User" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd5%') do if /i not "%%k"=="LocalService" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-19" /v ProfileImagePath /d "%DocSetDir0%\LocalService" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd6%') do if /i not "%%k"=="NetworkService" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-20" /v ProfileImagePath /d "%DocSetDir0%\NetworkService" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd7%') do if /i not "%%k"=="%UserName%" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%UserSID%" /v ProfileImagePath /d "%DocSetDir0%\%UserName%" /f >NUL )GOTO:EOF:CheckIfDuplicate1CALL:HeaderFOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd3%') do if /i "%%k"=="All Users" (CALL:UnHideIt "All Users" "%DocSetDir0%" & FOR /D %%A IN ("%~1.w*") DO CALL:DelDuplicateProfiles "%%A" %1 )FOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd4%') do if /i "%%k"=="Default User" (CALL:UnHideIt "Default User" "%DocSetDir0%" & FOR /D %%A IN ("%~2.*") DO CALL:DelDuplicateProfiles "%%A" %2 )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd5%') do if /i "%%k"=="LocalService" (CALL:UnHideIt "LocalService" "%DocSetDir0%" & FOR /D %%A IN ("%~3.*") DO CALL:DelDuplicateProfiles "%%A" %3 )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd6%') do if /i "%%k"=="NetworkService" (CALL:UnHideIt "NetworkService" "%DocSetDir0%" & FOR /D %%A IN ("%~4.*") DO CALL:DelDuplicateProfiles "%%A" %4 )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry3%^|%fnd7%') do if /i "%%k"=="%UserName%" (CALL:UnHideIt "%UserName%" "%DocSetDir0%" & FOR /D %%A IN ("%~5*") DO CALL:DelDuplicateProfiles "%%A" %5)CALL:FooterGOTO:EOF:DelDuplicateProfilesset /a theNum=%theNum%+1reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v RemoveDuplicateProfile%theNum% /d "%comspec% /C RMDIR /S /Q ""%1""" /f >NUL>> c:\AllUsersProfilefix.log echo %theNum% "%~nx1" was deleted from "%DocSetDir0%"GOTO:EOF:Header> c:\AllUsersProfilefix.log echo Fix and Remove Duplicate Profiles 1.1.9>> c:\AllUsersProfilefix.log echo Copyright 2005, `felix`.>> c:\AllUsersProfilefix.log echo Generated %DATE:~-10%.>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo This computer was found to have one or more duplicate system or user profiles. >> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo The following registry key has been updated with default values. >> c:\AllUsersProfilefix.log echo "%KEY%">> c:\AllUsersProfilefix.log echo.GOTO:EOF:Footer>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo This issue is possibly caused by the following reasons:>> c:\AllUsersProfilefix.log echo * The computer operating system has been reinstalled.>> c:\AllUsersProfilefix.log echo * The computer operating system has been restore from a back-up image.>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo For more information please see Microsoft Knowledge Base Article link below:>> c:\AllUsersProfilefix.log echo http://support.microsoft.com/default.aspx?scid=kb;en-us;314045>> c:\AllUsersProfilefix.log echo.GOTO:EOF:UnHideItfor /f "usebackq delims= tokens=1,2" %%i IN (`dir /ah /b "%~2\%~1*"`) DO IF /i "%%i" NEQ "%~1" attrib -a -s -h "%~2\%%i"GOTO:EOFendlocal Link to comment Share on other sites More sharing options...
`Felix` Posted March 1, 2005 Author Share Posted March 1, 2005 Hi guy'sWell i have been streamlining the code further and i think i have all the bugs out now accept one - when i run the process i am incrementing a number that is added to the runonce insert function to remove the directories found at next logon. The directories are found and logged, but the number is not incrementing for the like directories - see example below.Fix and Remove Duplicate Profiles 1.1.14Copyright 2005, `felix`.Generated 01/03/2005.This computer was found to have one or more duplicate system or user profiles. The following registry key has been updated with default values. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"1 "Daz.EPSILON" was deleted from "D:\Documents and Settings"1 "Daz.EPSILON.000" was deleted from "D:\Documents and Settings"1 "Daz.EPSILON.001" was deleted from "D:\Documents and Settings"1 "Daz.EPSILON.002" was deleted from "D:\Documents and Settings"This issue is possibly caused by the following reasons:* The computer operating system has been reinstalled.* The computer operating system has been restore from a back-up image.For more information please see Microsoft Knowledge Base Article link below:http://support.microsoft.com/default.aspx?...kb;en-us;314045The numbers in blue above should be sequencial, however because these are being picked up from the one dir listing they are getting the same number... Anyone got any ideas how i can do this better... current build of code below.@ECHO OFF:: Fix and Delete Duplicate Profiles 1.1.14:: Copyright 2005. `felix`.:: Credits to jaclaz, soulin and all the great people from MSFN:: for there help and testing IF %OS%!==! GOTO:EOFsetlocalset theNum=1set KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileListset gtid=getsid \\%computername% %username% \\%computername% %username%for /f "Tokens=7" %%i in ('%gtid%^') do (set UserSID=%%i)set qry1=reg query "%KEY%" /v ProfilesDirectoryset qry2=reg query "%KEY%" /sset qry3=reg query "%KEY%\%USERSID%" /v ProfileImagePathset fnd1=FIND /I "Documents and Settings"set fnd2=FIND /I "ProfileImagePath"set fnd3=FIND /I "AllUsersProfile"set fnd4=FIND /I "DefaultUserProfile"set fnd5=FIND /I "LocalService"set fnd6=FIND /I "NetworkService"set fnd7=FIND /I "%UserName%"for /f "Tokens=1,2*" %%i in ('%qry1%^|%fnd1%') do (set DocSetDir0=%%k)CALL:CheckCurrentLocalCALL:CheckIfDuplicateGOTO:EOF:CheckCurrentLocalFOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd3%') do if /i not "%%k"=="All Users" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v AllUsersProfile /d "All Users" /f >NUL )FOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd4%') do if /i not "%%k"=="Default User" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v DefaultUserProfile /d "Default User" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd5%') do if /i not "%%k"=="LocalService" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-19" /v ProfileImagePath /d "%DocSetDir0%\LocalService" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd6%') do if /i not "%%k"=="NetworkService" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-20" /v ProfileImagePath /d "%DocSetDir0%\NetworkService" /f >NUL )FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd7%') do if /i not "%%k"=="%UserName%" (reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%UserSID%" /v ProfileImagePath /d "%DocSetDir0%\%UserName%" /f >NUL )rem ping -n 2 127.0.0.1>nulGOTO:EOF:CheckIfDuplicateCALL:HeaderFOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd3%') do if /i "%%k"=="All Users" (CALL:DoIt "All Users" "%DocSetDir0%")FOR /f "Tokens=1,2*" %%i in ('%qry2%^|%fnd4%') do if /i "%%k"=="Default User" (CALL:DoIt "Default User" "%DocSetDir0%")FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd5%') do if /i "%%k"=="LocalService" (CALL:DoIt "LocalService" "%DocSetDir0%")FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry2%^|%fnd6%') do if /i "%%k"=="NetworkService" (CALL:DoIt "NetworkService" "%DocSetDir0%")FOR /f "delims=\ Tokens=1,2*" %%i in ('%qry3%^|%fnd7%') do if /i "%%k"=="%UserName%" (CALL:DoIt "%UserName%" "%DocSetDir0%")CALL:FooterGOTO:EOF:Header> c:\AllUsersProfilefix.log echo Fix and Remove Duplicate Profiles 1.1.14>> c:\AllUsersProfilefix.log echo Copyright 2005, `felix`.>> c:\AllUsersProfilefix.log echo Generated %DATE:~-10%.>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo This computer was found to have one or more duplicate system or user profiles. >> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo The following registry key has been updated with default values. >> c:\AllUsersProfilefix.log echo "%KEY%">> c:\AllUsersProfilefix.log echo.GOTO:EOF:Footer>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo This issue is possibly caused by the following reasons:>> c:\AllUsersProfilefix.log echo * The computer operating system has been reinstalled.>> c:\AllUsersProfilefix.log echo * The computer operating system has been restore from a back-up image.>> c:\AllUsersProfilefix.log echo.>> c:\AllUsersProfilefix.log echo For more information please see Microsoft Knowledge Base Article link below:>> c:\AllUsersProfilefix.log echo http://support.microsoft.com/default.aspx?...kb;en-us;314045>> c:\AllUsersProfilefix.log echo.GOTO:EOF:Doitfor /f "usebackq delims= tokens=1,2" %%i IN (`dir /ah /b "%~2\%~1*"`) DO IF /i "%%i" NEQ "%~1" attrib -a -s -h "%~2\%%i"for /f "usebackq delims= tokens=1,2" %%i IN (`dir /ad /b "%~2\%~1*"`) DO IF /i "%%i" NEQ "%~1" (set /a theNum=%theNum%+1reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v RemoveDuplicateProfile%theNum% /d "%comspec% /C RMDIR /S /Q """%~2\%%i"""" /f >NUL>> c:\AllUsersProfilefix.log echo %theNum% "%%i" was deleted from "%DocSetDir0%")GOTO:EOFendlocalCode that performs this function in PURPLEAny help would be greatly appreciated 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