Sync VS Code Settings between Computers with Different User Profile Paths

You're using Visual Studio Code (VS Code) on multiple computers and you've enabled the settings sync feature to synchronize your VS Code settings between computers.

Some VS Code settings reference files in your user profile. This creates a problem because the path to your user profile is different between computers. These user profile path differences cause some VS Code extensions to generate errors because they're unable to find the files specified in your settings.json configuration file:

sync-vscode-settings-diff-paths1a

Searching the Internet for a solution doesn't provide any helpful results. You try using environment variables in your VS Code settings.json file, but they don't seem to be supported. Asking ChatGPT about the problem says that user profiles with different paths are supported but confirms that environment variables aren't supported:

sync-vscode-settings-diff-paths2a

The most simplistic way to solve this problem without requiring any other configuration changes is to create a symbolic link pointing the directory name for the user profile that VS Code is looking for to the one that exists.

A symbolic or soft link is a link or pointer to the original file or directory, whereas a hard link is a copy of the original file or directory.

Launch PowerShell elevated as an admin and navigate to C:\Users or the location of your user profiles if you've changed the default:

1Set-Location -Path C:\Users

Create a symbolic link. Specify the name of the directory that your settings for VS Code is looking for as the value for the Path parameter. This is the name of the symbolic link. Specify the path to your actual user profile as the value for the Target parameter.

1New-Item -ItemType SymbolicLink -Path mikefrobbins -Target .\mikef

sync-vscode-settings-diff-paths3a

You could also use the mklink command from an elevated instance of cmd.exe to create the symbolic link.

1mklink /D mikefrobbins .\mikef

sync-vscode-settings-diff-paths4a

After creating the symbolic link, all VS Code settings work as expected across multiple computers with different user profile paths.

References