Everything You Need to Know About Google Chrome’s Profile Switcher

Run chrome with this command line switch

chrome.exe --user-data-dir="..\valid path to a directory\" -first-run

One easier way to run different chrome profile is

  1. Create a chrome application shortcut
  2. Right click, go to properties in the application path add this
     --user-data-dir="..\valid path to a directory\" -first-run
    after chrome.exe

To Change the Default Location of an Existing User Profile

1. Log on to the user account that you want to move. In Windows Explorer, navigate to it's  C:\Users\(user-name) folder, right click on the user folder, click on  Share with and  Nobody

2. Log off.

3. Log on to an  administrator account that you are not moving it's user folder for.
NOTE:  If you do not have another administrator account to use, then you will need to  create a new account  first and log in to it. When done with the tutorial, you can  delete the new account.

4. In Windows Explorer, navigate to the  C:\Users\(user-name) folder  (ex: C:\Users\User account to move) that you want to move. Right click on it and click on  Copy. (see screenshot below)
User Profile - Change Default Location-step1.jpg 
5. In Windows Explorer, navigate to the new location  (ex: E: drive) that you want to move the  C:\Users\(user-name) folder to. Right click on a empty space in the main window (middle), and click on  Paste. (see screenshot below)
NOTE:  This should be another internal hard drive or partition.
User Profile - Change Default Location-step2.jpg 
6. If prompted, click on  Continue. (see screenshot below)
User Profile - Change Default Location-step3-uac.jpg 
7. If prompted by  UAC, then click on  Yes (Windows 7) or  Continue (Vista).

8. The  C:\Users\(user-name) folder (step 4) is now copied over to the new location  (ex: E:\User account to move). You can close Windows Explorer. (see screenshot below)
User Profile - Change Default Location-step4.jpg
9. Open the Start Menu, then type  regedit in the search box and press enter.

10. If prompted by  UAC, then click on  Yes (Windows 7) or  Continue (Vista).

11. In regedit, navigate to the location below. (see screenshot below)
 

Code:

<span style="color:#323232">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</span>
User Profile - Change Default Location-step5.jpg 
12. In the left pane under the  Profilelist key, select and look at each  S-1-5 key with the long number until you see the  user account name and path (step 3) that you want to move in the value  Data column of  ProfileImagePath in the right pane. When the correct user name is found, right click on  ProfileImagePath, and click on  Modify. (see screenshot above)

13. Type in the full path of the location  (ex: E:\User account to move) that you copied the user profile folder to in step 7, and click on  OK. (see screenshot below)
User Profile - Change Default Location-step6.jpg 
14. Regedit will now look similiar to this with the new location now. Close regedit. (see screenshot below)
User Profile - Change Default Location-step7.jpg
15.  To Verify that the User Profile has been Moved Successfully
A)  Log off or  Switch User, then log in to the user account that you moved the user profile folder of. 

B) Open the Start Menu and open the user profile folder from this location. (see screenshot below)
User Profile - Change Default Location-log-1.jpg 
C) Right click on one of the user folders (ex: Desktop), click on  Properties, and click on the  Location tab. (see screenshot below)
User Profile - Change Default Location-log-2.jpg
D) You should see the new location  (ex: E:\User account to move\Desktopfrom step 8 as the now new default location. Click on  OK. (see screenshot above)
16. To Delete the User Profile from the Old Location 
NOTE:  Once you have verified (step 15) that the moved user profile has been moved successfully, you can now safely delete the user profile folder from the old location (ex: C:\Users\User account to move) from step 4.
A) Log off of the user account that you moved if you are logged into it from step 15. 

B) Log on to an  administrator account that you did not move it's user folder for.

C) In Windows Explorer, navigate to the old  C:\Users\(user-name) folder  (ex: C:\Users\User account to move) that you had copied (step 4). Right click on it and click on  Delete. (see screenshot below)
User Profile - Change Default Location-delete-1_uac.jpg
D) If prompted by  UAC, then click on  Yes (Windows 7) or  Continue (Vista).

E) If prompted, click on  Continue. (see screenshot below)
User Profile - Change Default Location-delete-2.jpg 
F) You can now empty the  Recycle Bin to finish deleting the old user profile folder from the old location.
NOTE:  You will need to approve emptying the Recycle Bin.
17. The existing user profile folder has now been completely moved to the new default location where Windows 7 or Vista will now run it from when logged on to it. 

 

To Restore the Existing User Profile's Default Location

1. Repeat OPTION ONE, but move the new default User Profile folder  (ex: E:\User account to move) and registry entries back to the original  C:\Users folder location  (ex: C:\Users\User account to move).

 

 

For All New User Accounts Created

 

Note   Note

This will change where all newly created user accounts will have their user profile folder created at in a default location of your choice instead of the old default C:\Users location. 

Thank you to Alain for pointing this out.

1.  To Change the Default User Profile Location of New User Accounts
A) Open the Start Menu, then type  regedit in the search box and press enter.
B) If prompted by  UAC, then click on  Yes (Windows 7) or  Continue (Vista).

C) In regedit, navigate to the location below. (see screenshot below)
 

Code:

<span style="color:#323232">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</span>
User Profile - Change Default Location-new-1.jpg
D) In the right pane of  ProfileList, right click on  ProfilesDirectory and click on  Modify. (see screenshot above)

E) Type in the full path (ex: E:\Users) of where you want new user accounts to be created at, and click on  OK. (see screenshot below)
User Profile - Change Default Location-new-2.jpg
F) The registry will now look similar to this. (see screenshot below)
User Profile - Change Default Location-new-3.jpg
G) When you  create a new user account, it's user profile folder will now be created at the location you specified in step 1E.
2. To Restore the Default User Profile Location of New User Accounts
A) Repeat step 1, but type  %SystemDrive%\Users at step  1E instead.
NOTE:  This step only changes the user profile folder location of any newly created user accounts back to this default location, and not any existing user accounts.

B) If you wish to change an already existing new account's user profile folder location, then you will need to do  Method Two in  OPTION ONE above to change it back to  C:\Users.
3. Close regedit.

That's it,
Shawn


Introduction
The user data directory contains profile data such as history, bookmarks, and cookies, as well as other per-installation local state.

Each profile is a subdirectory (often Default) within the user data directory.

Current Location
To determine the user data directory for a running Chrome instance:

Navigate to chrome://version
Look for the Profile Path field. This gives the path to the profile directory.
The user data directory is the parent of the profile directory.
Example (Windows):

[Profile Path] C:\Users\GbHi8bXhDyMP2m1NDUSiYmznAJdJzX36DDUser Data\Default
[User Data Dir] C:\Users\GbHi8bXhDyMP2m1NDUSiYmznAJdJzX36DDUser Data
Default Location
The default location of the user data directory is computed by chrome::GetDefaultUserDataDirectory.

Generally it varies by

OS platform,
branding (Chrome vs. Chromium, based on is_chrome_branded in GN args), and
release channel (stable / beta / dev / canary).
Windows
The default location is in the local app data folder:

[Chrome] %LOCALAPPDATA%\Google\Chrome\User Data
[Chrome Canary] %LOCALAPPDATA%\Google\Chrome SxS\User Data
[Chromium] %LOCALAPPDATA%\Chromium\User Data
(The canary channel suffix is determined using InstallConstants::install_suffix.)

Mac OS X
The default location is in the Application Support folder:

[Chrome] ~/Library/Application Support/Google/Chrome
[Chrome Canary] ~/Library/Application Support/Google/Chrome Canary
[Chromium] ~/Library/Application Support/Chromium
(The canary channel suffix is determined using the CrProductDirName key in the browser app's Info.plist.)

Linux
The default location is in ~/.config:

[Chrome Stable] ~/.config/google-chrome
[Chrome Beta] ~/.config/google-chrome-beta
[Chrome Dev] ~/.config/google-chrome-unstable
[Chromium] ~/.config/chromium
(The beta and dev channel suffixes are determined from $CHROME_VERSION_EXTRA, which is passed by the launch wrapper script.)

The ~/.config portion of the default location can be overridden by $CHROME_CONFIG_HOME (since M61) or by $XDG_CONFIG_HOME.

Note that $XDG_CONFIG_HOME affects all applications conforming to the XDG Base Directory Spec, while $CHROME_CONFIG_HOME is specific to Chrome and Chromium.

Chrome OS
The default location is: /home/chronos

Android
The default location comes from Context.getDir and is specific to the app.

Example: /data/user/0/com.android.chrome/app_chrome

iOS
The default location is inside the application support directory in the app sandbox.

[Chrome] Library/Application Support/Google/Chrome
[Chromium] Library/Application Support/Chromium
Overriding the User Data Directory
Command Line
On all platforms, the user data directory can be overridden by passing the --user-data-dir command-line flag to the Chrome binary.

Example:

[Windows] chrome.exe --user-data-dir=c:\foo
[Linux] google-chrome --user-data-dir=/path/to/foo
Environment (Linux)
On Linux, the user data directory can also be overridden with the $CHROME_USER_DATA_DIR environment variable.

The --user-data-dir flag takes precedence if both are present.

Chrome Remote Desktop sessions (Linux)
A single Chrome instance cannot show windows on multiple X displays, and two running Chrome instances cannot share the same user data directory. Therefore, it's desirable for Chrome to have a separate user data directory when running inside a Chrome Remote Desktop (CRD) virtual session on a Linux host.

By default, CRD achieves this by setting $CHROME_USER_DATA_DIR in the session. Unfortunately this means that inside the session we don't get separate defaults for different channels (Stable, Beta, Dev) or for Chrome vs. Chromium. This can lead to profile version errors (“Your profile can not be used because it is from a newer version of Google Chrome”).

Since M61, this can be solved by setting $CHROME_CONFIG_HOME instead of $CHROME_USER_DATA_DIR. Specifically, put the following in ~/.chrome-remote-desktop-session:

export CHROME_CONFIG_HOME="$HOME/.config/chrome-remote-desktop/chrome-config"
unset CHROME_USER_DATA_DIR
. /etc/chrome-remote-desktop-session
Then restart the host by running: /etc/init.d/chrome-remote-desktop restart

Writing an AppleScript wrapper (Mac OS X)
On Mac OS X, you can create an application that runs Chrome with a custom --user-data-dir:

Open Applications > Utilities > Script Editor.

Enter:

set chrome to "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\""
set userdatadir to "\"$HOME/Library/Application Support/Google/Chrome Alt\""
do shell script chrome & " --user-data-dir=" & userdatadir & " > /dev/null 2>&1 &"
Modify as needed for your installation path, Chrome versus Chromium, and desired user data directory.

Save the script in your Applications directory with the file format “Application”.

Close the Script Editor, find your newly created application, and run it. This opens a Chrome instance pointing to your new profile.

If you want, you can give this application the same icon as Chrome:

Select the Google Chrome application and choose File > Get Info.
Select the icon at the top left of the info dialog. You will see a blue highlight around the icon.
Press ⌘C to copy the icon.
Open the info dialog for the new application and select the icon in the top left.
Press ⌘V to paste the copied icon.


User Cache Directory
On Windows and ChromeOS, the user cache dir is the same as the profile dir. (The profile dir is inside the user data dir.)

On Mac OS X and iOS, the user cache dir is derived from the profile dir as follows:

If Library/Application Support is an ancestor of the profile dir, the user cache dir is Library/Caches plus the relative path from Application Support to the profile dir.
Otherwise, the user cache dir is the same as the profile dir.


Example (Mac OS X):

[user data dir] ~/Library/Application Support/Google/Chrome
[profile dir] ~/Library/Application Support/Google/Chrome/Default
[user cache dir] ~/Library/Caches/Google/Chrome/Default
On Linux, the user cache dir is derived from the profile dir as follows:

Determine the system config dir. This is ~/.config, unless overridden by $XDG_CONFIG_HOME. (This step ignores $CHROME_CONFIG_HOME.)
Determine the system cache dir. This is ~/.cache, unless overridden by $XDG_CACHE_HOME.
If the system config dir is an ancestor of the profile dir, the user cache dir is the system cache dir plus the relative path from the system config dir to the profile dir.
Otherwise, the user cache dir is the same as the profile dir.


Example (Linux):

[user data dir] ~/.config/google-chrome
[profile dir] ~/.config/google-chrome/Default
[user cache dir] ~/.cache/google-chrome/Default
On Android, the user cache directory comes from Context.getCacheDir.


original url: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/user_data_dir.md

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值