Click here to Skip to main content
15,893,508 members
Articles / Programming Languages / PowerShell
Tip/Trick

How to Export VS Code Extensions to Another Computer using PowerShell

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
21 May 2019CPOL1 min read 18.6K   4   2
How to export VS code extensions to another computer using PowerShell

Setting Up the Script

VS Code is one of my favourite IDEs for web development and text editing. In my opinion, it is currently the best choice out there if you are looking for a powerful development tool with a rich set of features. One thing lacking from VS Code is the ability to easily transfer your development setup and extensions from one machine to another. In this blog post, I will demonstrate a simple piece of PowerShell that makes it very straightforward.

First, open up the command prompt (you will need PowerShell installed and enabled) then navigate to a directory where you have permission to create files.

Run the following command:

PowerShell
code --list-extensions | ForEach-Object {"code --install-extension $_"} > extensions.ps1

This will create a PowerShell script file named extensions.ps1 in your chosen directory.

Running the Script

Now for the final step, simply transfer the created script into a directory on the target machine.

Navigate to the folder containing the script and run it using the following command:

PowerShell
.\extensions.ps1

The script will run and install all of the extensions taken from your initial development environment.

If the extensions have customization settings you would like to transfer, you will also need to copy over your settings.json.

This can be achieved by opening VS Code on the initial development environment and holding Ctrl+Shift+P to show a list of available commands. Type “Preferences: Open Settings (JSON)” and hit enter.

This will open a file called settings.json. To transfer your user settings, simply copy the contents to the target machine by running the same command to open the file.

That’s it! You should now have a development environment that has been transferred to another machine by running a simple PowerShell script.

This article was originally posted at https://tomling.github.io/feed.xml

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionMessage Closed Pin
17-Jun-21 22:47
Member 1525252017-Jun-21 22:47 
GeneralMessage Closed Pin
28-Oct-20 23:21
professionalBrayden Lin28-Oct-20 23:21 
QuestionGreat information Pin
Member 1456654122-Aug-19 22:21
Member 1456654122-Aug-19 22:21 
QuestionInteresting post Pin
alexis.kittleson21-May-19 19:56
alexis.kittleson21-May-19 19:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.