MSFN Forum: Moveing Documents And Settings on installation. - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Moveing Documents And Settings on installation. Need help with command lines Rate Topic: -----

#1 User is offline   Worf 

  • Worf
  • PipPip
  • Group: Members
  • Posts: 187
  • Joined: 26-October 04

Posted 05 March 2006 - 10:34 AM

Hi



I'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.



Quote

cmdnow @ /HID
echo off


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%



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"


EXIT






Now the problem is in the REG ADD lines. I'm getting the errors which is:



[b]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 Thanks



Worf.



P.S. This part works [b]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. :D

This post has been edited by Worf: 05 March 2006 - 10:37 AM



#2 User is offline   Doc Symbiosis 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 333
  • Joined: 03-August 04

Posted 05 March 2006 - 05:23 PM

First thing, you shouldn't use this way to set the mydoc variable
Set 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""""

This post has been edited by Doc Symbiosis: 05 March 2006 - 05:23 PM


#3 User is offline   bladehawke 

  • Group: Members
  • Posts: 1
  • Joined: 20-February 06

Posted 05 March 2006 - 05:33 PM

View PostWorf, on Mar 5 2006, 08:34 AM, said:

Hi



I'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?

Quote

Now the problem is in the REG ADD lines. I'm getting the errors which is:



[b]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.micro....com/kb/314843/

#4 User is offline   exrcizn 

  • Rock Star
  • PipPip
  • Group: Members
  • Posts: 123
  • Joined: 15-October 04

Posted 06 March 2006 - 01:40 PM

Quote

cmdnow @ /HID


This part isn't correct. I think you need to remove the n.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy