How to create a Chrome profile programmatically?

前端 未结 3 903
小鲜肉
小鲜肉 2021-02-04 02:41

Development, testing, staging environments are controlled via different proxy servers in my setup. I want to script creation of multiple Chrome profiles (sometimes called \"user

3条回答
  •  不知归路
    2021-02-04 03:10

    Creating a user

    The following example applies to Windows, but the basic procedure should be the same.

    First, change to the UserData folder in your Chrome installation:

    cd "%APPDATA%\..\Local\Google\Chrome\User Data"
    

    This method will copy the current user as a template for the new user. If the new user should be blank, you need to delete (CTRL + SHIFT + DEL the current browser data).

    Now create a new user:

    mkdir NewUser && copy Default NewUser
    

    Change your directory to the chrome installation:

    cd "C:\Program Files (x86)\Google\Chrome\Application"
    

    Factory-Reset all user parameters:

    chrome.exe --user-data-dir="..\User Data\NewUser" -first-run
    

    where --user-data-dir is the path (full or relative) to the previously created NewUser directory.

    Running as NewUser

    To run chrome again using this profile, simply run chrome without the -first-run flag.

提交回复
热议问题