In a recent update of Chrome (version 90.0.4430.93 at the time of writing), the user data directory argument (user-data-dir
) behavior changed.
Before, you were able to launch Chrome with an additional argument like so:
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' --user-data-dir=chrome
which will create a custom user data directory in the working directory.
However, now if you launch the above command, you will get the following error:
Interestingly, if you run the same command in an elevated prompt (Run as Administrator), you won’t get any error, but you also cannot see the chrome
folder created in your working directory!
What happened was that Chrome actually tried to create the user data directory not in the working directory, but in its executable directory, which, in case of a 64-bit installation, in C:\Program Files\Google\Chrome\Application
, and as expected if you run the command as a normal user, you shouldn’t be able to write anything to C:\Program Files\
.
A workaround to this issue is to specify an absolute path to the user data directory that you want to create instead of just the directory name. For example,
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' --user-data-dir=D:/chrome
should create chrome
in the expected D:
drive.
I haven’t tested if this behavior is exclusive to Windows or if it is prevalent on other platforms.