Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Script to change Profile folders's locations

30 Nov 2015   #1
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 
Script to change Profile folders's locations

Hi,

At my home, I have a Server 2008 R2 domain with all clients running Win 7. I personally do not like storing user documents and files in the C\User folder as it has a lot of other profile junk in it. I simply create a folder called C\Data and create MyDocs, Music, Download, Videos etc folders in it. After that I manually redirect each type of folders from the current location to these new locations. This allows me to easily backup the required data rather than all the stuff that I don't care for. When profiles get bloated, I simply delete them and then redirect folders from the new profile again. All the data remains in the C:\Data.

All this redirecting can get tedious. I am looking for a script (vb script, batch file, reg file, power shell script) that I can have pre-configured with locations and simply run when I need redirection.

Any help is appreciated.

Thanks


My System SpecsSystem Spec
.
01 Dec 2015   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi DJ...,

Before any script can be made, I'll need you to provide more details about the task you describe. Namely, would you be able to outline the process that you'd take normally; that is, how exactly would you achieve your task the "tedious", manual way?
My System SpecsSystem Spec
02 Dec 2015   #3
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 

Hi,

I create the following folders manually.

C:\Data\User1\MyDocs
C:\Data\User1\Music
C:\Data\User1\Videos
C:\Data\User1\Pics
C:\Data\User1\Download
C:\Data\User1\Favs

Then manually redirect the corresponding folders from C:\Users\User1\.

This seems like an easy enough task if it is one off but if I create a new user, then I have to do this to every PC/Laptop that user will use. Also, about a month or so ago, I had to rebuild my server which mean old user profiles on the user PCs were no longer valid when logging on to the domain. For this reason, I had to do this for each user for every PC/Laptop.

If I can script this, then I can easily modify the script for location and user and simply run it.

Thanks.
My System SpecsSystem Spec
.

02 Dec 2015   #4
cyclops

Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

I have several great books from which, after many hours of trial and error testing, I have learned how to write my own scripts. Would you be interested in learning the process of creating your own scripts which will meet your precise needs?
My System SpecsSystem Spec
02 Dec 2015   #5
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 

I don't mind the learning process. I believe I am pretty good with batch and reg files (yep, oldie). I can work with some VB scripts as well. However, I simply do not know where these locations are stored.

(I have no practical experience with Power Shell)
My System SpecsSystem Spec
02 Dec 2015   #6
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 

I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are. If I can find that out, then I can probably script it.

I thought about using AutoIT to do this and perhaps use Send Keys but that seems a but too dodgy solution to me.
My System SpecsSystem Spec
02 Dec 2015   #7
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 

OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

All of the user folders' locations are listed here. I can now create a modified reg file easily.

Thanks.
My System SpecsSystem Spec
02 Dec 2015   #8
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by DJDJDJDJ View Post
I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are.
Quote   Quote: Originally Posted by DJDJDJDJ View Post
OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Very close. This registry key exists only for backwards compatibility, and changing values under this key will have no effect on the locations of users' folders. Windows defines user folders under the following registry key,
Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
I'm not fully clear on your intentions, DJ, but I doubt a reg file is fit for the task--it is not a script--and if you change data under either of the mentioned keys, do know that you'll still have to manually move items in C:\Users\User1 to the new location C:\Data\User1.

On any note, if you require assistance with a script or reg file, feel free to post any snippets here for review.
My System SpecsSystem Spec
02 Dec 2015   #9
DJDJDJDJ

Windows 7 64 bit - Server 2008 R2 (64bit)
 
 

Thank you very much for this.

I think reg file will work well for me.

I do not need to move any data files. They will always be in C:\Data\*. I simply need to point any new user profiles to folders in this location. This allows me to have all the user files in location without any system or application generated files.

For example, C:\Users\%username%\ folder contains folders for appdata, searches etc. I really don't care for these folders. iTunes etc. create a log of garbage there. Even Microsoft folder can contain a ton of files. They are necessary for running apps but I don't want to worry about backing them up. By moving the important actual content folders, I can keep a clean data folder for backups.

I am aware that reg file will not move files. I don't really need to move files. If it is a new profile, it is not going to have any data files to move anyway. If I am relocating an existing profile, then I can manually move the data files as it will be a one-off relocation.

I will create a batch file that will check for the existence of the destination folders and create them if necessary. It can then merge the reg file. :-)



Quote   Quote: Originally Posted by Pyprohly View Post
Quote   Quote: Originally Posted by DJDJDJDJ View Post
I should clarify that I know the location of the folders but I do not know where Windows is storing the information that tell you where these folders are.
Quote   Quote: Originally Posted by DJDJDJDJ View Post
OK, I think I found the location in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Very close. This registry key exists only for backwards compatibility, and changing values under this key will have no effect on the locations of users' folders. Windows defines user folders under the following registry key,
Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
I'm not fully clear on your intentions, DJ, but I doubt a reg file is fit for the task--it is not a script--and if you change data under either of the mentioned keys, do know that you'll still have to manually move items in C:\Users\User1 to the new location C:\Data\User1.

On any note, if you require assistance with a script or reg file, feel free to post any snippets here for review.
My System SpecsSystem Spec
Reply

 Script to change Profile folders's locations




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
WIN7 BKUP utility restores files & folders in both old & new locations
I recently experimented with the WIN7 BACKUP & RESTORE utility & did a full backup. Afterwards, I shuffled subdirectories around to different locations & then did an incremental backup. I did confirm that it was indeed an incremental & not a "new" backup data set. Restoring from the incremental...
Backup and Restore
Windows Fax and Scan - locations of folders
Well, I played around and found something interesting. I was going to move my FAX and SCANNED DOCUMENTS folders (they are in Libraries -> Documents) to my D: drive (using a symbolic link or junction). In FAX and Scan, if you go to FAX VIEW, you can see the following folders (left pane): ...
Performance & Maintenance
No longer able to change wallpaper locations
Hi All, After a nice crash I can no longer change my wallpaper folders? I can download and install themes but as soon as I click on browse I can find and select a differant folder but no pictures are shown and the folder location next to browse does not change? I tried the reg file to enable...
Customization
Link 2 folders in different locations?
Is there a way to link 2 folders? I have a Dropbox account and folder in one area of my documents and a school folder in another. When I save assignments I am working on to my school folder, I'd like to have it automatically make a copy in my Dropbox folder so that I can access these files remotely...
Network & Sharing
Setting shell folders to network locations
Hi, I have a number of PCs connecting to a server where we house our personal folders. The server also houses music, basketball games, our photos, applications (like drivers and updates etc). On XP and vista I could update shell folders in registry to point each of the various locations (Like...
Network & Sharing
Default User Locations - Duplicate Folders
Hey, Like always, I'm changing my user folder to my other hard drive and I'm run into the same problem I have with Vista. I've changed the location on all of them to D:\username\foldername. (Default: C:\Users\username\foldername). All of them, EXCEPT pictures, music and video have disappeared...
Music, Pictures & Video


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 21:24.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App