Visual Studio Code: Getting Started with PowerShell
This TechNet Wiki "Getting Started" aims to provide simple basic instructional information, links to material related to Visual Studio Code to get anyone started. Feel free to improve this article relevant to the Visual Studio Code and adjust the table of contents where appropriate.
1. Introduction
Visual Studio Code was announced with a preview released on 29th April 2015 by Microsoft at 2015 Build conference. On 18th November 2015, Visual Studio Code was released under the OpenSource MIT License and its source code released to GitHub with Extension support announced. On 14th April 2016, Visual Studio Code graduated public preview stage and was released to public.
Visual Studio Code is a source code editor that supports a number of programming languages such as C, C++, C#, CSS, F#, HTML, Less, Java, JavaScript, JSON, Markdown, PHP, PowerShell, Python, Rust, Sass, Swift, Text, TypeScript, Visual Basic, XML, XSL and YAML. For users, Visual Studio Code has installable for multiple operating system platforms such as Windows, Debian, Ubuntu, Redhat, Fedora, CentOS, OS X Yosemite and El Capitan. It is also able to integrate with Git for GitHub.
2. Getting Started with Visual Studio Code
In this section, we will get started by downloading and installing Visual Studio Code just to get you started on working with Visual Studio Code.
2.1. Requirements
Since Visual Studio Code is available in multiple variety of Operating System platform, we high recommend you to find the correct package for your platform from the download site below:
2.2. Download Visual Studio Code using PowerShell
In this section, we will demonstrate how to download Visual Studio Code using PowerShell on Windows.
# Download Visual Studio Code from
# https://code.visualstudio.com/#alt-downloads
Invoke-WebRequest `
-Uri 'https://go.microsoft.com/fwlink/?LinkID=623230' `
-OutFile 'C:\Temp\VSCodeSetup-stable.exe' ;
2.3. Install Visual Studio Code silently using PowerShell
In this section, we will demonstrate how to install Visual Studio Code silently using PowerShell on Windows. You can also refer to the setup resource for Windows operating system below:
# Begin SILENT installation of
# Visual Studio Code
Start-Process `
-FilePath 'C:\Temp\VSCodeSetup-stable.exe' `
-ArgumentList '/SILENT /LOG="C:\Temp\VSCodeSetup.log"' ;
2.4. Install Visual Studio Code on Non-Windows Operating System
In this section, we will provide the setup resources for Non-Windows operating system below:
Once Visual Studio Code has been installed, you can launch Visual Studio Code and have your first peek of the application.
2.5. Working with Integrated Terminal
In this section, we will demonstrate on changing the Integrated Terminal shell and using the Integrated Terminal to install extension from the marketplace.
2.5.1. Displaying the Integrated Terminal
In this section, we will discuss about how we can display the Integrated Terminal within Visual Studio Code and view the default shell for the first time.
To do this, you have 2 ways of displaying the Integrated Terminal:
- Select View > Integrated Terminal
- CTRL + `
Once you have displayed the Integrated Terminal, you will see that the Integrated Terminal default shell is the Command Shell (CMD.exe) as below.
2.5.2. How to change the default Integrated Terminal to PowerShell
In this section, we will demonstrate on how we can modify the Integrated Terminal configuration to launch PowerShell instead of Command Shell by changing the User Settings in the Visual Studio Code Preferences.
To do this, you can use the Visual Studio Code graphical interface menu:
- Select File > Preferences > User Settings
On the settings.json tab > add the following JSON line within the curly brackets:
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe"
Once you have added the overriding JSON syntax into setting.json file, you will have to save the settings.json and restarted the application.
To do this, you have 2 ways to save the file:
- Select File > Save
- CTRL + S
After saving the settings.json, you will have to exit Visual Studio Code and launch Visual Studio Code again.
Once Microsoft Visual Studio Code launched, display the Integrated Terminal again. Now, you will view the Integrated Terminal in PowerShell.
2.6. Working with Extension
In this section, we will demonstrate how to install the PowerShell extension from the marketplace and improve the Visual Studio Code experience with IntelliSense.
2.6.1. Installing Microsoft Visual Studio Code PowerShell extension
To install PowerShell extension from Marketplace using Integrated Terminal, we will launch the Integrated Terminal and issue the command below:
# Using the Integrated Terminal, we can install
# the PowerShell extension by calling code.exe
# with the appropriate parameter.
code --install-extension ms-vscode.PowerShell
Once the PowerShell extension has been installed into Visual Studio Code and restarted the Visual Studio Code, you can test the PowerShell IntelliSense by writing some PowerShell code like the example in the screenshot below.
2.6.2. List installed Microsoft Visual Studio Code extensions
To list installed extensions using Integrated Terminal, we will launch the Integrated Terminal and issue the command below:
# Using the Integrated Terminal, we can list
# the installed extension by calling code.exe
# with the appropriate parameter.
code --list-extensions
2.6.3. Uninstalling a Microsoft Visual Studio Code extension
To uninstall extension using Integrated Terminal, we will launch the Integrated Terminal and issue the command below:
# Using the Integrated Terminal, we can uninstall the
# Debugger for Chrome extension by calling code.exe
# with the appropriate parameter.
code --uninstall-extension msjsdiag.debugger-for-chrome
3. Getting Started with GitHub on Visual Studio Code
In this section, we will get started by downloading and installing Git just to get you started on Visual Studio Code with Git integration in order to synchronise with GitHub repositories.
3.1. Requirement
With Git available in multiple variety of Operating System platform, we high recommend you to find the correct package for your platform from the download site below:
3.2. Download Git using PowerShell
In this section, we will demonstrate how to download Git for Visual Studio Code using PowerShell on Windows.
# Download Git from
# https://git-scm.com/downloads
Invoke-WebRequest `
-Uri 'https://github.com/git-for-windows/git/releases/download/v2.10.0.windows.1/Git-2.10.0-64-bit.exe' `
-OutFile 'C:\Temp\Git-2.10.0-64-bit.exe' ;
3.3. Install Git silently using PowerShell
In this section, we will demonstrate how to install Git silently for Visual Studio Code using PowerShell on Windows. You can also refer to the setup resource for Windows operating system below:
# Begin SILENT installation of
# Git version 2.10.0 X64
Start-Process `
-FilePath 'C:\Temp\Git-2.10.0-64-bit.exe' `
-ArgumentList '/SILENT /LOG="C:\Temp\GitSetup.log"' ;
3.4. Use Git to clone a repository from GitHub
With Git and Visual Studio Code installed, we will demonstrate how to clone the Open Source PowerShell repository in GitHub using Integrated Terminal (PowerShell) or PowerShell console to your local disk and open the folder to view the entire Open Source PowerShell source code locally.
# Navigate to Git bin folder
Set-Location `
-Path 'C:\Program Files\Git\bin' ;
# Use Git to clone the PowerShell Repository
# from GitHub to local personal folder
Git clone https://github.com/PowerShell/PowerShell.git "$Env:USERPROFILE\Documents\Visual Studio Code\PowerShell"
Once the Git clone of the GitHub's PowerShell repository has completed and you have open the folder using Visual Studio Code using the Visual Studio Code's menu:
- Select File > Open Folder…
- Select the cloned repository folder
4. Conclusion
After you have open the folder using Visual Studio Code, you will be able to use Visual Studio Code to view and work with the source code or even contribute to the PowerShell community through GitHub.
Welcome to the new Open Source Microsoft community, we have got you started with Visual Studio Code. If you think you can improve Visual Studio Code application further, we will welcome your feedback in GitHub (Microsoft/vscode).
5. Reference
- Visual Studio Code - Official Site
- Visual Studio Code Documentation
- Visual Studio Code Blog
- Visual Studio Code Updates
- Visual Studio Code FAQ
- Visual Studio Code Marketplace
- Git - Official Site
- Git - Documentation
- MSDN Blog - Visual Studio Code – NEW FEATURES: 7 Editor Improvements (Code Folding, IntelliSense, Indentation, Ruler, & More!) by Ed Price - MSFT
- MSDN Blog - Visual Studio Code – NEW FEATURES: JavaScript – Salsa Preview by Ed Price - MSFT
- MSDN Blog - Visual Studio Code – All the Git Features!!! by Ed Price - MSFT
- MSDN Blog - Visual Studio Code – NEW FEATURE: VS Code Supports Extensions! by Ed Price - MSFT
- YouTube - Welcome to VS Code by Visual Studio Code
- YouTube - Configure and Extend VS Code by Visual Studio Code
- YouTube - IntelliSense in VS Code by Visual Studio Code
- YouTube - Advanced Code Editing in VS Code by Visual Studio Code
- YouTube - Git Version Control in VS Code by Visual Studio Code
- YouTube - Debugging in VS Code by Visual Studio Code
6. See Also
- GitHub with Visual Studio by Mukesh.Kumar
- Running ASP.NET 5 and Visual Studio Code for MAC by Fiqri
- Visual Studio Code PowerShell Extension: Create a Script Module for tasks in SharePoint Online by Chen V
- Go under the hood with Visual Studio Code by Hussain Shahbaz Khawaja
- PowerShell: Getting Started with Binary Module for PowerShell Core by Kia Zhi Tang (Ryen Tang)