March 5, 200620 yr HiI've manage to find a way to move Documents And Settings to another drive using CMD but i have an error.Here's what i have done.cmdnow @ /HIDecho offfor %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%a:\Documents and Settings\%USERNAME%Set MYDOC=%%a:\Documents And Settings\%USERNAME%SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders] ; SET KEY Needs to point to Reg Entry[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]REG ADD %KEY%\001 /V 1 /D "REGEDIT /S AppData"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Application Data"REG ADD %KEY%\002 /V 2 /D "REGEDIT /S Cookies"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Cookies"REG ADD %KEY%\003 /V 3 /D "REGEDIT /S Desktop"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Desktop"REG ADD %KEY%\004 /V 4 /D "REGEDIT /S Favorites"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Favorites"REG ADD %KEY%\005 /V 5 /D "REGEDIT /S NetHood"="%MYDOC%\\Documents and Settings\\%MYDOC%\\NetHood"REG ADD %KEY%\006 /V 6 /D "REGEDIT /S Personal"="%MYDOC%\\Documents and Settings\\%MYDOC%\\My Documents"REG ADD %KEY%\007 /V 7 /D "REGEDIT /S PrintHood"="%MYDOC%\\Documents and Settings\\%MYDOC%\\PrintHood"REG ADD %KEY%\008 /V 8 /D "REGEDIT /S Recent"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Recent"REG ADD %KEY%\009 /V 9 /D "REGEDIT /S SendTo"="%MYDOC%\\Documents and Settings\\%MYDOC%\\SendTo"REG ADD %KEY%\010 /V 10 /D "REGEDIT /S Start Menu"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Start Menu"REG ADD %KEY%\011 /V 11 /D "REGEDIT /S Templates"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Templates"REG ADD %KEY%\012 /V 12 /D "REGEDIT /S Programs"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Start Menu\\Programs"REG ADD %KEY%\014 /V 14 /D "REGEDIT /S Startup"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Start Menu\\Programs\\Startup"REG ADD %KEY%\015 /V 15 /D "REGEDIT /S Local Settings"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Local Settings"REG ADD %KEY%\016 /V 16 /D "REGEDIT /S Local AppData"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Local Settings\\Application Data"REG ADD %KEY%\017 /V 17 /D "REGEDIT /S Cache"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Local Settings\\Temporary Internet Files"REG ADD %KEY%\018 /V 18 /D "REGEDIT /S History"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Local Settings\\History"REG ADD %KEY%\019 /V 19 /D "REGEDIT /S My Pictures"="%MYDOC%\\Documents and Settings\\%MYDOC%\\My Documents\\My Pictures"REG ADD %KEY%\020 /V 20 /D "REGEDIT /S My Music"="%MYDOC%\\Documents and Settings\\%MYDOC%\\My Documents\\My Music"REG ADD %KEY%\021 /V 21 /D "REGEDIT /S CD Burning"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Local Settings\\Application Data\\Microsoft\\CD Burning"REG ADD %KEY%\022 /V 22 /D "REGEDIT /S My Video"="%MYDOC%\\Documents and Settings\\%MYDOC%\\My Documments\\My Videos"EXITNow the problem is in the REG ADD lines. I'm getting the errors which is:REG ADD %KEY%\001 /V 1 /D "REGEDIT /S AppData"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Application Data"Error: Too many command-line parameters Can anyone please help?Many ThanksWorf.P.S. This part works For %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%a:\Documents and Settings\%USERNAME%Set MYDOC=%%a:\Documents And Settings\%USERNAME%It scans the drives finds documents and setting\username. Edited March 5, 200620 yr by Worf
March 5, 200620 yr First thing, you shouldn't use this way to set the mydoc variableSet MYDOC=%%a:\Documents And Settings\%USERNAME% because you can't be sure, that this really is your profilepath.You should better use the environment variable %Userprofile%Set MYDOC=%USERPROFILE%Other thing is, I wonder, why you use the %MYDOC% to times in the path?REG ADD %KEY%\001 /V 1 /D "REGEDIT /S AppData"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Application Data"In any case, the error comes up, because there are spaces in the path to your profiledirectory, so regedit takes them as different parameters. To avoid this, enclose the path in "triple double quotes" "Appdata"=""""%MYDOC%\\Application Data"""" Edited March 5, 200620 yr by Doc Symbiosis
March 5, 200620 yr HiI've manage to find a way to move Documents And Settings to another drive using CMD but i have an error.Why not set it to a particular location during install as opposed to moving it afterward?Now the problem is in the REG ADD lines. I'm getting the errors which is:REG ADD %KEY%\001 /V 1 /D "REGEDIT /S AppData"="%MYDOC%\\Documents and Settings\\%MYDOC%\\Application Data"Error: Too many command-line parameters Two obvious issues here, IMHO. One, you aren't backquoting; and two the expansion of the variables.REG ADD %KEY%\001 /V 1 /D "REGEDIT /S AppData\"=\"%MYDOC%\\Application Data"should be closer to what you are trying. Your original code (assuming %MYDOC%="C:\Documents and Settings\User") would expand to C:\Documents and Settings\User\Documents and Settings\C:\Documents and Settings\User\Application Data which I am certain is not what you are after,Ultimately, per MS, the way to move Docs and Settings is in pre-installation http://support.microsoft.com/kb/314843/
Create an account or sign in to comment