Installing VSCode extensions from a list
I was building a new VM for doing some security testing and one of the most boring things to do when I build a new one is putting all my tooling together.
One of my favorite tools is VSCode. I like it’s versatility, the fact that I can use it with any language it’s something I really like. Another I hate doing is installing the extensions, and I wanted to see if there was a way to automate this.
I found that vscode supports cli and you can install the extensions via the command line using the code ‘code –install-extension
To backup your current extensions to feed it to the script use the command:
code --list-extensions > VSCode_Extension_List.txt
Here is the script for Linux:
#!/usr/bin/env bash
cat $1 | while read extension || [[ -n $extension ]];
do
code --install-extension $extension --force
done
Here is the script for Windows using PowerShell:
Get-Content $args[0] | ForEach-Object {code --install-extension $_}
I have tested the Linux one, but not the PowerShell one. In theory it should work!
Reference: