Jump to content

moving my documents


Recommended Posts

My 2c :D

redirect.inf

Version]
Signature=$CHICAGO$

[DefaultInstall]
AddReg = Reg.Settings

[Reg.Settings]
HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal",0x00000,"D:\Docs"
HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","My Pictures",0x00000,"D:\Docs\Pix"

Link to comment
Share on other sites


Are you sure you need the double %%? I think they'll result in D:\%USERNAME%\.
Yes I'm sure, the key is reg_expand_sz for that reason. Otherwise I would have said
@ECHO OFF&SETLOCAL ENABLEEXTENSIONS
SET DRIVE=D:
SET USF=Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
SET MYDOC=%DRIVE%\%USERNAME%\My Documents
SET MUSIC=%MYDOC%\My Music
SET PICS=%MYDOC%\My Pictures
REG ADD "HKCU\%USF%" /V "My Music" /D "%MUSIC%" /F >NUL
REG ADD "HKCU\%USF%" /V "My Pictures" /D "%PICS%" /F >NUL
REG ADD "HKCU\%USF%" /V Personal /D "%MYDOC%" /F >NUL
ENDLOCAL&GOTO :EOF

Also, the Windows NT Command Script syntax uses :: for a remark /comment not the old batch method of REM.

<Edit>costi During install</Edit>

Edited by Yzöwl
Link to comment
Share on other sites

The only two questions from the opening gambit as I see it are

1. How to determine if D: exists

2. How to move 'My Documents' to D:

The only code I and no other respondee gave was one to search for the existence of D:. However as a simple fix for that a simple change to line 2 to this may help

IF NOT EXIST D: (GOTO :EOF) ELSE (SET DRIVE=D:)

The later mention of junctions does however cause confusion. If the profiles directories are moved to D: then as a direct result of that move and as a container for the 'My Documents' folder the registry will be updated accordingly. As I stated earlier the 'User Shell Folders' data is by default of type REG_EXPAND_SZ. The keys in question by default use the %USERPROFILE% variable which in this case will expand to D:\Documents and Settings\Users_Name\My Documents..., thus negating the need for any additional changes.

Link to comment
Share on other sites

@Yzöwl

I guess my PM didn't impress you :) Ok, here's the quote

I have a different setup on my machine - I moved the whole "Documents And Settings" folder to partition D: (D:\documents and settings) using junctions from Win2k (linkd.exe tool).

If anyone's familiar with this technique, can you tell if there's a way to backup the existing junctions and restore them after reinstall?

I have a multi-user setup and creating the junctions is kinda tricky. Last time I was doing it, it took me 3 hours of trial and error - you can imagine I don't feel like going through that again.

If copying them is not an option, any other way of migrating Documents And Settings to a different location is welcome.

I imagine he has user documents under D:\Documents and Settings\Username\My Documents.

I may be missing something, but I don't understand how your code helps in this case

SET MYDOC=%DRIVE%\%%USERNAME%%\My Documents

implies that each user will have My Documents folder as D:\Username\My Documents while the actual documents are stored elsewhere.

Link to comment
Share on other sites

@ Vadikan

I'm sorry for not responding to your PM, the point I need to make is that my batch file example(s) were in reply to the thread starter, bobthenob, not costi. My only response to costi was in fact made specifically to them by name and in response to their question.

Link to comment
Share on other sites

  • 2 months later...

Here's my adaptation of Yzöwl's wonderous batch, run from Cmdlines.txt:

@ECHO OFF&SETLOCAL ENABLEEXTENSIONS

COLOR 8f

LABEL C: Boot

-->IF NOT EXIST D: GOTO EOF<-- not working for me, any ideas?

IF EXIST D:\%1 GOTO EOF

FORMAT D: /FS:NTFS /V:Storage /Q /Y

SET DRIVE=D:

SET USF=Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

SET MYDOC=%DRIVE%\%%USERNAME%%\My Documents

SET MUSIC=%DRIVE%\%%USERNAME%%\My Documents\My Music

SET PICS=%DRIVE%\%%USERNAME%%\My Documents\My Pictures

REG ADD "HKCU\%USF%" /V "My Music" /T REG_EXPAND_SZ /D "%MUSIC%" /F >NUL

REG ADD "HKCU\%USF%" /V "My Pictures" /T REG_EXPAND_SZ /D "%PICS%" /F >NUL

REG ADD "HKCU\%USF%" /V Personal /T REG_EXPAND_SZ /D "%MYDOC%" /F >NUL

MD "%DRIVE%\Acronis True Image Files"

ENDLOCAL&GOTO :EOF

If a clean D: partition does exist, then format it, name it, move My Documents to it, and add an extra directory for backup purposes. If a D: partition does not exist or if any data resides on same, then abort the batch.

<EDIT>

I thought the "IF NOT EXIST" statement would work, but it fails. I partition the drive manually at the beginning of the install and create two partitions, a C: and D: The batch works fine without that line. Anyone have any ideas?

</EDIT>

Edited by blinkdt
Link to comment
Share on other sites

@blinkdt

thanks for your reply :) but in my uacd or computer D partition is data partition and there are some files. so i dont want to format it. just want to move my docs to D partition without formatting. can you correct your batch accordingly pls ? of course with "if statement" again because in my opinion this is a much more flexible situation.

thanks in advance

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...