Friday, December 23, 2022

Countdown to 2023... Shortcuts to webpages using Chrome profiles

Countdown / Chrome.

You can launch Chrome with a specific user profile, but, unfortunately, there's no easy way AFAIK to discern which profile number matches a specific profile name. Here's a. how to figure out the profile number, and b. how to share batch files and scripts over different machines with different profile names.

Why? Because you might use the same website with different profiles, ie. settings, and you don't want to manually log out and in again.


Lazy Geek

I have to admit all this fooling around with profiles was primarily triggered by being a lazy geek, running TouchPortal, and trying to build scripts to speed up bursts of writing. I wonder if I didn't lose more time than I won, but hey... Geek for life.


Open any URL with a specific user profile


1. Select the right profile in Chrome (a new browser window may open up)

2. Menu (triple dot) / Settings / Customize your Chrome Profile

3. Scroll down

4. Create desktop shortcut

5. On your desktop is now a new icon, with the image belonging to the selected profile superimposed over it.

6. RMB on the icon

7. Properties

8. Under the Shortcut tab, in the 'Target' field, the correct profile number will be listed. The shortcut will look something like this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1"

9. To launch Blogger with that specific profile, the shortcut would look something like this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" "https://www.blogspot.com"


Use a batch file to use the same scripts on different machines

So, after the steps above, you know that the specific profile has a profile number for that PC. If you move to a different PC, you may find out that same profile has a different profile number. It is unfortunately not possible to select a profile by providing a name. (It's rather odd Google / The Chromium team left that option out, but whatever.)

Again, unfortunately, profile numbers may be different on another machine, so where on my desktop PC the profiles line up like this:
  • default - my regular account
  • profile 1 - ninelizards - what I use for this blog
  • profile 2 - angeljay - a wannabe author account

My laptop has them like this:
  • default - my regular account
  • profile 1 - angeljay - a wannabe author account
  • profile 2 - ninelizards - what I use for this blog

Instead of calling Chrome directly with a profile number, I use an intermediate batch file. That means that I can use the same batch files and TouchPortal settings for both machines, and only have to modify three batch files.

Instead of directly opening Chrome like this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Default" "https://www.blogspot.com"


... I use intermediate batch files, and open chrome like this:

call chrome_default "https://www.blogspot.com"


The file chrome_default.bat looks like this on both machines:

start "Chrome" /B "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Default" "%1"


The file chrome_ninelizards.bat looks like this on my home desktop PC:

start "Chrome" /B "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" "%1"


The file chrome_ninelizards.bat looks like this on my laptop:

start "Chrome" /B "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 2" "%1"


All the other batch files, TouchPortal settings etc. are the same on both machines. When copying a setup to a new / another machine, sharing batch files etc. I just have to re-edit the files that launch my browser. (Yep, I never start my browser directly, or open up a URL directly, and try to send everything through those batch files whenever possible.)

Here's the touch portal button for opening comments on my blog (I rarely need it 😢)


(Click to enlarge)

See also this post.


No comments:

Post a Comment