2

I have a lot of command line switches appended to the end of my shortcut to Chrome, but every time I launch chrome without using the shortcut, it loses the switches. Also, when chrome is launched from an in-app call.

A good example is in the recent Chrome canary builds where it renders the title bar's and context menu's without GDI. A quick fix was to use the switch: --disable-directwrite-for-ui. P.S: I use mactype

If you were to relaunch Chrome in Windows 8 mode, it loses the switch.

Question:

Is there any way to make Chrome work with command line switches without launching from a shortcut?

1
  • With wmic process where "name='chrome.exe'" get CommandLine command you can see all current switches chrome is running with.
    – JosefZ
    Commented Mar 20, 2015 at 12:54

4 Answers 4

1

Set an environment variable like:

setx vChromeLaunchParamSet1 "C:\Program Files(x86)\Google\Chrome\Application\chrome.exe -param1 -param2 -param3 -aram4"

Then whenever you need to launch Chrome with your parameters, execute like this:

%vChromeLaunchParamSet1%

or

start "" %vChromeLaunchParamSet1%

or

start "My Extra Special Chrome Session" %vChromeLaunchParamSet1%

2

I am using windows 10. Hope its the same.


There is link how to do it with incognito. It is my main source of inspiration. https://www.winhelponline.com/blog/always-start-google-chrome-incognito-mode-default/


I found no uniform solution, but good results are reached by combining different solutions on different situations:

links and HTML files:

open regedit.exe and go to:

\HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command

The original value wil be something similar to:

"C:\Program Files (86x)\Google\Chrome\Application\chrome.exe" --"%1"
(there was no double hyphen (-) before "%1" on my PC)

Insert all parameters you want before "%1". Treat this as cmd command, where "%1" is new URL.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-directwrite-for-ui "%1"

Icon pinned on toolbar

This icon is shortcut. If you right-click it, on the pop-up window you can right-click the row titled "Google Chrome", which will lead you to properties. On the shortcut tab add your desired parameters in "Target" Editbox right after the path.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-directwrite-for-ui

running from command line or other program

Use environment variable, just as @wschloss proposed.


Those combined leave you with only running from start-menu as issue, which you can either avoid or call batch file instead "chrome.exe".

1

Here is one solution that will do the trick.

  1. Rename your chrome.exe to chrome_real.exe

  2. Create a batch file in the same directory and call it chrome.cmd. make that file launch chrome_real.exe with the arguments you want, for example: chrome_real.exe --disable-directwrite-for-ui %* (%* is used to append all arguments that your batch was called with).

  3. Use a program to convert your batch file to exe, such as this one. After this you'll have a "fake" chrome.exe file that calls the real chrome, but prepends your parameters to it. Since all programs are associated with calling chrome.exe and not chrome_real.exe, all of them will call your program which calls the original chrome, making it seamless.

2
  • Thanks for the quick hack, however this doesn't work for opening a file in Chrome from an external call, I just get the prompt Windows can't find the file chrome_real.exe when its in the same path as chrome.exe . Also for launching Chrome in Windows 8 mode. Commented Mar 22, 2015 at 23:28
  • Add a cd C:\Program Files (x86)\Google\Application (or whatever the path to chrome_real.exe is) as a first line in your batch file - that should solve it. As for Windows 8 mode, I'm not sure how exactly it works so I don't know whether this solution can help there.
    – fstanis
    Commented Mar 23, 2015 at 1:13
0

Open a command prompt and change to the Chrome program folder, e.g. CD \Users\Fred\AppData\Local\Google\Chrome\Application\

To find the folder on your PC you can right click on an existing Chrome shortcut, then "properties".

Then run chrome.exe with whatever switches you want, e.g. chrome.exe --app=https://superuser.com/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .