Windows Dev Environment
Windows Dev Environment
Windows invites you to code as you are. Use whatever coding language or framework
you prefer - whether developing with tools on Windows or with Linux tools on the
Windows Subsystem for Linux, this guide will help you get set up and install what you
need to start coding, debugging, and accessing services to put your work into
production.
Developer tools
Dev Home
Monitor your work in the centralized dashboard, GitHub and System performance
widgets. Get setup and onboard new projects with the Machine configuration tool.
Install Dev Home
Dev Drive
Improve performance by storing project files on a Dev Drive and keep files secure with
trust designation, antivirus configuration, and attached filters.
Create a Dev Drive
WinGet Configuration
Consolidate manual machine setup and project onboarding to a single command that is
reliable and repeatable.
Author a configuration file
Windows Subsystem for Linux
Use your favorite Linux distribution fully integrated with Windows (no more need for
dual-boot).
Install WSL
Windows Terminal
Customize your terminal environment to work with multiple command line shells.
Install Terminal
Windows Package Manager
Use the winget.exe client, a comprehensive package manager, with your command line
to install applications on Windows.
Install Windows Package Manager
Microsoft PowerToys
Tune and streamline your Windows experience for greater productivity with this set of
power user utilities.
Install PowerToys
Windows Subsystem for Android
Windows Subsystem for Android™️support ends March 5, 2025.
Learn more
https://learn-video.azurefd.net/vod/player?id=54e6c532-a86c-4a39-81ab-
40e28ce2ba96&locale=en-us&embedUrl=%2Fwindows%2Fdev-environment%2F
Windows Copilot
The first PC platform to provide centralized AI assistance and designed to help people
easily take action and get things done is coming soon! See the Blog announcement .
https://learn-video.azurefd.net/vod/player?id=72ad293b-b7aa-4a78-9111-
46eb0e072d7b&locale=en-us&embedUrl=%2Fwindows%2Fdev-environment%2F
Development paths
Get started with JavaScript
Get started with JavaScript by setting up your development environment on Windows or
Windows Subsystem for Linux and install Node.js, React, Vue, Express, Gatsby, Next.js, or
Nuxt.js.
Visual Studio
An integrated development environment that you can use to edit, debug, build code,
and publish apps, including compilers, intellisense code completion, and many more
features.
Install Visual Studio
Azure
A complete cloud platform to host your existing apps and streamline new development.
Azure services integrate everything you need to develop, test, deploy, and manage your
apps.
Set up an Azure account
.NET
An open source development platform with tools and libraries for building any type of
app, including web, mobile, desktop, gaming, IoT, cloud, and microservices.
Install .NET
You can also use Windows Terminal to open all of your favorite command line tools in
the same window with multiple tabs, or in multiple panes, whether that's PowerShell,
Windows Command Prompt, Ubuntu, Debian, Azure CLI, Oh-my-Zsh, Git Bash, or all of
the above.
Keyboard shortcuts
Trackpad shortcuts
Terminal and shell tools
Apps and utilities
Dev Home is a new control center for Windows providing the ability to monitor projects
in your dashboard using customizable widgets, set up your dev environment by
downloading apps, packages, or repositories, connect to your developer accounts and
tools (such as GitHub), and create a Dev Drive for storage all in one place.
To update Dev Home to the latest version, run the following command in Windows
Terminal: winget upgrade Microsoft.DevHome
Dev Home Machine configuration
To set up a new machine or onboard a new project with Dev Home, select Machine
configuration. Dev Home can manage everything you need to get to your machine's
development environment to a ready-to-code state, whether you want an end-to-end
setup process, want to use a WinGet Configuration file, or just want to perform a quick
step, like cloning a Git repository, installing a specific application, or adding a Dev Drive
to improve the performance of your project's storage volume.
Learn more about how to get started with the Dev Home Machine configuration tool.
System widgets
The Dev Home system widgets can provide real-time information on:
Memory: Amount in use, total available, total committed, total cached, paged
pool, non-paged pool.
Network: Bandwidth measurements, including total kilobits per second for both
sending and receiving data, along with the network name.
CPU: Total utilization, speed, and active processes.
GPU: Total utilization, temperature, and graphics chip name.
GitHub extension widgets
The Dev Home GitHub extension enables you to connect your GitHub account to Dev
Home and create customized widgets that integrate with your GitHub repositories. To
connect your GitHub account to Dev Home and begin creating GitHub widgets:
1. Once you've installed Dev Home, the GitHub extension will be available by default,
but you will need to log-in to your GitHub account to gain access to the integrated
features. Currently Dev Home supports only a single GitHub account. (See the
DevHome Extension repo on GitHub for updates on adding support for multiple
accounts.)
2. Select Add a widget from the top-right of your Dev Home dashboard. A list of
widget options will appear that you can pin and then customize to your
preference.
Learn more about the Dev Home GitHub extension and how to create customized
widgets and set up Windows notifications.
Learn more about Dev Home extensions, including how to create customized GitHub
widgets, set up GitHub notifications, create custom ADO widgets, or build and share
your own Dev Home extensions.
1. Install the Dev Home Azure extension from the Microsoft Store.Once installed, if
your machine is connected to a work account already, Dev Home will connect
automatically. Otherwise, you can sign into your Azure account in Dev Home's
account settings.
2. Select Add a widget from the top-right of your Dev Home dashboard. A list of
widget options will appear that you can pin and then customize to your liking.
You can also contribute to the open source documentation for Dev Home by visiting the
Windows Dev Docs open source repo on GitHub .
The Dev Home machine configuration tool brings all of your dev environment set up
tasks into one place, enabling you to efficiently set up a new machine or onboard new
projects.
Avoid all of the fractured and tedious processes typically involved in getting your
machine ready for development. Dev Home streamlines the process of searching for
project requirements, cloning repositories, and finding specific versions of software and
tools to install. Manage multiple tool sign-ins, minimize context switching, and reach
productivity faster so you can focus on what you do best - developing.
Machine configuration
Dev Home Machine configuration can manage everything you need to get to your
machine's development environment to a ready-to-code state.
When you select Machine configuration, Dev Home will provide multiple set up
options:
Set up a local machine: Install applications, clone repositories, and add all of the
requirements for a new development project using the built-in graphical
configuration interface to enable unattended setup of your environment. The step-
by-step tool will walk you through everything you need, including suggestions for
popular dev tools or known repositories. At the end of the process you can
generate a WinGet Configuration file to make it easy to apply these same steps to
any machine. Once you've made all of your choices, sit back and let Dev Home
handle the rest. If you've cloned any repositories that contain a WinGet
Configuration file, Dev Home will detect that and let you continue to complete
your set up.
Run a configuration file for an existing setup: Use a WinGet Configuration file to
consolidate all of your machine setup and project onboarding tasks into a single
file, making the process of setting up your development environment reliable and
repeatable. WinGet Configuration files use a YAML format with a JSON schema
applying Windows Package Manager and PowerShell Desired State Configuration
(DSC) Resource modules to handle every aspect of your machine set up. Remove
any worry over finding the right software version, packages, tools, frameworks, and
settings when onboarding to a new team or project. In this experience you can
switch between a summary view or check out the raw contents of the YAML file. Be
sure to check the trustworthiness of a WinGet Configuration file before running it.
Clone repositories: Once you have connected your credentials using the Dev
Home GitHub extension or the Dev Home Azure extension, you can use Dev Home
to clone repositories on to your machine.
Install applications: Use Dev Home to discover and install software applications --
one at a time or have Dev Home install several while you take a snack break.
Add a Dev Drive: To add a storage volume that utilizes ReFS and optimized
security settings to be more performant for development-focused scenarios,
consider adding Dev Drive. You must currently be running a Windows Insider
Program Build on the Dev Channel in order to use Dev Drive. Learn more in the
Dev Drive docs.
If you have not yet created a Dev Drive, you will have the option to create one using Dev
Home. Check the box to optimize the performance of your workloads with a Dev Drive.
Then you can customize a few options, such as the drive letter, name, size, and location
of the dynamic VHDX on which the Dev Drive will be created. The name will be used for
both the VHDX file and the Dev Drive. By default, the options are the next available drive
letter, size of 50GB, and created at %userprofile%\DevDrives .
Dev Home supports both default and custom-built extensions. Learn more about the
Dev Home GitHub extension, how to customize Git widgets and notifications in the Dev
Home dashboard, and how to build your own Dev Home extension.
The GitHub extension is currently the only extension included with Dev Home by
default, however new extensions are in active development.
To add the GitHub extension, select the Extensions tab in Dev Home, then select Get on
the GitHub extension from the list of Dev Home extensions Available in the Microsoft
Store.
When signing into GitHub using the Dev Home GitHub Extension, your GitHub
credentials are added to the Credential Manager . This is how Dev Home is able to
access information relevant to your GitHub account. Currently DevHome supports only a
single GitHub account. (See the DevHome Extension repo on GitHub for updates on
adding support for multiple accounts.)
Want to contribute to or file an issue on this extension? See the open source GitHub
extension repository for Dev Home .
To add the Azure extension, select the Extensions tab in Dev Home, then select Get on
the Azure extension from the list of Dev Home extensions Available in the Microsoft
Store.
If you're logged into Windows with an Azure work account, the extension will
automatically detect your account after installation.
Want to contribute to or file an issue on this extension? See the open source Azure
extension repository for Dev Home .
Query results
Query tiles with counts of items per query
Pull requests for a specific ADO repo that are created by you, assigned to you, or
assigned to your team
6 Collaborate with us on
GitHub
The source for this content can
be found on GitHub, where you
can also create and review
issues and pull requests. For
more information, see our
contributor guide.
Windows developer
feedback
Windows developer is an open
source project. Select a link to
provide feedback:
Dev Home Environments can help you to centralize your interactions with these virtual
or cloud environments in a single place.
2. Enable the Environments features in the Dev Home Experimental settings (Settings
> Experimental features > toggle to On).
3. Each type of virtual environment in Dev Home is supported by a Dev Home
extension. To add a new environment, you must first ensure that the supporting
extension is installed.
1. The type of virtual environment (such as Hyper-V VM, Microsoft Dev Box, more
coming soon).
2. The name of the virtual environment instance (whatever name you have chosen for
the environment).
4. Environment specific information, such as the project name for a Microsoft Dev
Box, the vCPU usage, the RAM usage, the storage capacity, the uptime, or
checkpoints.
Microsoft Dev Box will launch in the web browser by default. To launch the
Dev Box in the new Windows App RDP client, install Windows App from
Microsoft Store.
2. Start or Stop: Select the drop-drown arrow beside the Launch button to find the
start and stop actions.
3. Delete, Restart, Pin to taskbar: Select the 3-dots above the Launch button to
delete, restart, or pin this virtual environment to the Windows Taskbar.
The "Pin to Taskbar" and "Pin to Start menu" actions will not appear unless
Windows App is installed from Microsoft Store.
4. Sync: Select the Sync button on the top of the Dev Home Environments window if
your virtual environment has been installed, but is not displayed. For example, if
you have Dev Home open and simultaneously delete a Hyper-V VM outside of Dev
Home, or create a new Microsoft Dev Box in the Azure portal, these changes may
not be reflected in Dev Home until you select Sync or Dev Home relaunches.
2. Select the type of environment you would like to create (only supported and
installed environment types will be available).
3. Each environment can have different creation parameters, such as name, pool,
project, image, and more. These specifications depend on the environment type.
Adjust advanced Windows settings, such as showing file extensions, hidden and
system files, full paths in the title bar, empty drives, and more in File Explorer.
Optimize the performance of your Windows machine using Dev Drive insights.
New experimental features.
2. Enable any Windows Customization experimental features that you wish to use in
the Dev Home Experimental settings (Settings > Experimental features > toggle
to On).
Show file extensions: Display the file extension (for example .docx or .png ) when
listing files in File Explorer.
Show hidden and system files: Display all files in File Explorer even if they are
marked as a hidden or system file.
Show full path in title bar: Display the full file path in File Explorer rather than
using abbreviated paths.
Show files after extraction is complete: Displays all files after an unzip (extract)
action is performed on files or folders from a zipped (compressed) folder.
Show empty drives: All attached drives will display in File Explorer, even if empty.
End Task: Enable the ability to end a task using a right-click selection from the
Windows taskbar.
Check Dev Drive information at a glance, such as total size, amount of storage space
used and amount of storage space available.
Dev Drive Insights will also list suggestions for moving package caches, such as the Pip
cache or NuGet cache location, in order to improve your machine's performance. This
suggestion may look something like: "Move contents of C:\Users\user-
name\AppData\Local\npm-cache to a directory on the Dev Drive, such as G:\packages\npm
After ending a "Quiet Background Processes" session, you can review an Analytic
summary to see how this setting may have impacted CPU usage during your
development time.
*The Quiet Background Processes feature in Dev Home is only available on modern
versions of Windows 11 and will not be displayed or available as an experimental feature
on unsupported versions of Windows.
6 Collaborate with us on
GitHub
The source for this content can
be found on GitHub, where you
can also create and review
issues and pull requests. For
more information, see our
contributor guide.
Windows developer
feedback
Windows developer is an open
source project. Select a link to
provide feedback:
Dev Drive is a new form of storage volume available to improve performance for key
developer workloads.
Dev Drive builds on ReFS technology to employ targeted file system optimizations and
provide more control over storage volume settings and security, including trust
designation, antivirus configuration, and administrative control over what filters are
attached.
See the blog post: Dev Drive for Performance Improvements in Visual Studio and Dev
Boxes for some average improvement measurements across common dev operations.
When updating to the latest Windows 11 release, you may need an additional reboot
before the Dev Drive feature becomes available. If you are working in a business
enterprise environment, your security administrator will need to Configure Dev Drive
security policy in order to enable Dev Drive.
2 Warning
Dev Drive is intended only for key developer scenarios and any custom settings
will still be covered by Group Policy settings in Business or Enterprise work
environments. Learn more about how to Configure Dev Drive security policy.
Set up options
You will be given three options:
Virtual hard disk name: Give a name to your VHD (Dev Drive).
Location: Assign a directory path where the Dev Drive VHD will be located on your
machine. The default location is C:\ , unless creating a Dev Drive using Dev Home,
in which case the default location is %userprofile%\DevDrives . We recommend
using a per-user directory path location to store your Dev Drive to avoid any
unintentional sharing.
Virtual hard disk size: Assign the amount of disk space that will be allocated for
the volume to use, minimum size is 50GB.
Virtual hard disk format:
VHD: Supports virtual disks up to 2040 GB in size.
VHDX (Recommended): Supports a maximum of 64 TB and offers more resilient
protection against unexpected IO failure caused by issues like power outage.
Learn more about Managing VHDs.
Disk type:
Fixed size - This virtual hard disk file is allocated to the maximum size when
created.
Dynamically expanding - The virtual hard disk file grows to its maximum size as
data is written to the disk. (Recommended)
Once you complete the process of selecting between these options, your Dev Drive will
be created.
Existing storage volumes cannot be converted to be a Dev Drive. The Dev Drive
designation happens only at the original format time.
To find and use unallocated space on an existing drive, you can open System >
Storage > Disks & volumes, look through the page to see whether any storage space is
listed as "Unallocated". Select Create volume and you will be given the choices to
Create Simple Volume (a standard NTFS storage volume) or Create Dev Drive. To create
a Dev Drive, the steps are the same as above, you will need to add a Label (drive name),
Drive Letter, and confirm the Size allocation.
Format a storage volume as a Dev Drive from the
command line
As an alternative to using Windows Settings, there are two options for creating Dev
Drive storage volumes from the command line. Both options require that you open the
command line as an Administrator. You must be a member of the Admin group to
format a hard drive. These command line formatting methods may be preferred when
creating multiple Dev Drives or as an admin for multiple machines.
1. Using the Format command line tool from Windows CMD or PowerShell:
CMD
Format D: /DevDrv /Q
PowerShell
These code samples require that you replace D: with the drive location you wish to
target. See the links for more options and command parameters.
How does Dev Drive work?
A Storage Volume specifies how data is stored on the file system, via directories and
files, in a particular format. Windows uses NTFS for the system drive and, by default, for
most non-removable drives. The Resilient File System (ReFS) is a newer Microsoft file
system format, designed to maximize data availability, scale efficiently to large data sets
across diverse workloads, and provide data integrity with resiliency to corruption. It
seeks to address an expanding set of storage scenarios and establish a foundation for
future innovations.
The Dev Drive utilizes ReFS enabling you to initialize a storage volume specifically for
development workloads, providing faster performance, and customizable settings that
are optimized for development scenarios. ReFS contains several file system specific
optimizations to improve the performance of key developer scenarios.
Visual Studio
MSBuild
.NET SDK
Windows SDK, etc.
7 Note
IT Admins will want to create per-user Access Control List (ACL) folders for multi-
user devices as a best practice to avoid EOP attacks.
Npm cache (NodeJS): Create an npm cache directory in your Dev Drive, e.g.
D:\packages\npm , then set a global environment variable npm_config_cache to that
To verify the global-packages folder, run the dotnet nuget locals command:
dotnet nuget locals global-packages --list . The restore will install and
download packages into the new path. The default NuGet global-packages
folder can be deleted. Learn more in the NuGet docs: Managing the global
packages, cache, and temp folders.
vcpkg cache: Create a vcpkg cache directory in your Dev Drive, e.g.
D:\packages\vcpkg , then set a global environment variable
Pip cache (Python): Create a pip cache directory in your Dev Drive, e.g.
D:\packages\pip , then set a global environment variable PIP_CACHE_DIR to that
path, e.g. setx /M PIP_CACHE_DIR D:\packages\pip . If you have already restored pip
packages and Wheels on your machine, move the contents of
%LocalAppData%\pip\Cache to this directory. Learn more in the pip docs: pip
Cargo cache (Rust): Create a Cargo cache directory in your Dev Drive, e.g.
D:\packages\cargo , then set a global environment variable CARGO_HOME to that
Maven cache (Java): Create a Maven cache directory in your Dev Drive, e.g.
D:\packages\maven , then set a global environment variable MAVEN_OPTS to add a
%USERPROFILE%\.m2 to this directory. Learn more in the Maven docs and see
StackOverflow for How to specify an alternate location for the .m2 folder or
settings.xml permanently? .
Gradle cache (Java): Create a Gradle cache directory in your Dev Drive, for
example, D:\packages\gradle . Then, set a global environment variable
GRADLE_USER_HOME to point to that path, for example, use setx /M GRADLE_USER_HOME
"D:\packages\gradle" in the command line to set it system-wide. After setting this
variable, Gradle will use the specified directory ( D:\packages\gradle ) for its caches
and configuration files. If you have existing Gradle files, move the contents of
%USERPROFILE%\.gradle to this new directory. For more detailed information, you
can refer to the Gradle documentation and explore community resources like
StackOverflow for tips on managing Gradle configurations and cache directories .
Antivirus filters, including both Microsoft Defender and 3rd-party antivirus filters, are
attached to a Dev Drive by default. Microsoft Defender Antivirus defaults to the new
"performance mode" setting on Dev Drives, taking speed and performance into account,
while providing a secure alternative to folder exclusions. For an increased level of
protection, Microsoft Defender also offers "Real-time protection mode".
Any product or features requiring additional filters will not work unless the filter is
added to Dev Drive.
2 Warning
Dev Drives can be run with no antivirus filters attached. Exercise extreme caution!
Removing antivirus filters is a security risk and means that your storage drive will
not be covered by the standard security scans. You are responsible for evaluating
the risks associated with detaching antivirus filters and should only do so when
confident that your files stored on the Dev Drive will not be exposed to malicious
attacks.
Microsoft recommends using the default performance mode setting when using a
trusted Dev Drive.
A Dev Drive marked as trusted is a signal for Microsoft Defender to run in performance
mode. Running Microsoft Defender in performance mode provides a balance between
threat protection and performance. Real-time protection will still be enabled on all other
storage volumes.
Due to the security considerations of having filters detached, transporting a dev drive
between machines will result in the volume being treated as an ordinary volume without
special filter attach policies. The volume needs to be marked as trusted when it is
attached to a new machine. See How do I designate a Dev Drive as trusted?.
An untrusted Dev Drive will not have the same privileges as a trusted Dev Drive. Security
will run in real-time protection mode when a Dev Drive is untrusted. Exercise caution if
designating trust to a Dev Drive outside of the time that it is first created.
How do I designate a Dev Drive as trusted?
To designate a Dev Drive as trusted:
PowerShell
PowerShell
The C: drive on your machine cannot be designated as a Dev Drive. Developer tools,
such as Visual Studio, MSBuild, .NET SDK, Windows SDK, etc, should be stored on your
C:/ drive and not in a Dev Drive.
To learn more about performance mode and how it compares with real-time protection,
see Microsoft Defender: Protecting Dev Drive using performance mode.
For performance mode to be enabled, the Dev Drive must be designated as trusted and
Microsoft Defender Real-time protection must be set to "On".
PowerShell
disallowAv : Specifies that your Dev Drive(s) do not have any attached filters (not
even antivirus). Filters can be added back using fsutil devdrv setfiltersallowed
<Filter-1> command. (Replacing <Filter-1> with the name of your desired filter.)
allowAv : Specifies that Dev Drives are to be protected by the default antivirus
filter.
For help, enter the command: fsutil devdrv enable /? . If neither /allowAv nor
/disallowAv is specified, the antivirus policy for your Dev Drive is not configured and
2 Warning
To learn more about filters, see About file system filter drivers, Installing a filter driver,
Filter Manager Concepts, Load order groups and altitudes for minifilter drivers.
Filters specifically set as Allowed can attach to a Dev Drive in addition to antivirus filter
policy discussed above.
To use the setfiltersallowed command to allow Filter-01 and Filter-02 on all Dev
Drives, use the command:
PowerShell
To display the filter attach policy for all Dev Drives, use the command:
PowerShell
To change this Dev Drive configuration to allow only Filter-03 on your Dev Drive(s),
with Filter-01 and Filter-02 no longer allowed to attach, use the command:
PowerShell
ノ Expand table
Resource Monitor: Shows resource usage. Required to show file names in Disk FileInfo
Activity
Windows Upgrade: Used during OS Upgrade. Required if user moves TEMP WinSetupMon
environment variable to Dev Drive
PowerShell
Tip
To determine the filters required for a specific scenario, you may need to
temporarily mark a Dev Drive as untrusted. Then, run the scenario and make note of
all filters that attached to the volume. Designate the Dev Drive as trusted again and
then add the filters to the Allow list for that Dev Drive to ensure the scenario
succeeds. Finally, remove any filters that may not be needed, one at a time, while
ensuring that the scenario works as expected.
Tip
The filter name for Process Monitor may change. If adding the filter name
"ProcMon24" doesn't seem to capture file system activities on a Dev Drive, list the
filters using the command fltmc filters , find the filter name for Process Monitor,
and use that name instead of "ProcMon24".
Open Windows Settings menu, then choose Storage, then Advanced Storage Settings,
then Disks & volumes, where you will find a list of the storage volumes on your device.
Select Properties next to the Dev Drive storage volume that you want to delete. In the
drive's properties, you will find the option to Delete under the Format label.
The Dev Drive will now be deleted. However, if the Dev Drive was created as a new VHD,
the VHD will need to be deleted to reclaim the storage space used by that VHD. To
accomplish this, you must detach the virtual disk so that the VHD file hosting the Dev
Drive can be deleted, following these steps:
) Important
If working for a business or enterprise, the Dev Drive would still be managed by
your enterprise settings. Some customizations may therefore be unavailable
depending on the company policy.
potential side effects. We also recommend using performance mode for Microsoft
Defender for asychronous performance gains using Dev Drive. Turning Microsoft
Defender completely off may result in the most maximum performance gains, but this
may increase security risks and is a setting controlled by the system admin.
For more information, see the blog post: Dev Drive for Performance Improvements in
Visual Studio and Dev Boxes .
PowerShell
Enterprise-level administrators are often responsible for managing security across many
different Windows devices within an organization. There are multiple ways to configure
the policies that control whether new features are enabled as the become available in
new Windows releases. This guide covers important information about Windows 11 Dev
Drive storage volume features and how to configure Group Policy for your organization
to enable developers to use this performance-optimized storage format while
maintaining security and control over attaching file system filters.
Guidance on how to enable Group Policy can be found below using your preferred
policy management tool:
Microsoft Intune,
Microsoft Configuration Manager (ConfigMgr, formerly MEMCM/SCCM), or
Windows 11 Local Group Policy Editor.
Prerequisites
Windows 11, Build #10.0.22621.2338 or later (Check for Windows updates)
Recommend 16gb memory (minimum of 8gb)
Minimum 50gb free disk space
Dev Drives are available on all Windows SKU versions.
Dev Drive will be automatically disabled for devices that have their Windows updates
managed by policies. Disabling the ability to create a Dev Drive is only temporary to
allow security administrators time to decide on and roll out new policy updates.
Guidance for determining and configuring those policy updates is outlined below.
Determine Group Policy for Dev Drive storage
enablement and antivirus filter security
Group Policy is a Windows feature that lets enterprise administrators manage the
settings of work devices and have some control over what setting changes user
accounts (local administrators) are allowed to make in a business environment.
Antivirus filters, including both Microsoft Defender and 3rd-party antivirus filters, are
attached to a Dev Drive by default. The default settings for Dev Drive storage volumes
also allow local device administrators to control what filters are attached. This means
that a local device administrator could configure the system to remove default antivirus
filters, so that no antivirus filters are attached to the Dev Drive. If this is a concern, Group
Policy may be configured to ensure that antivirus filters remain attached when Dev Drive
is enabled. Additionally, an allowed file system filter list may be defined.
Not Configured: By default, the Dev Drive storage volume option will be turned off
under the Temporary enterprise feature control policy until enabled by an
enterprise administrator in the Group Policy.
Enabled: Enabling turns on the option to create Dev Drive storage volumes.
Options - Let antivirus filter protect Dev Drives: Dev Drives are optimized for
performance in developer scenarios, allowing the local administrator (user
account) to choose which file system filters are attached. This also allows local
administrators to detach the default antivirus features, unless the option to "Let
antivirus filter protect Dev Drives" is checked. Checking this option forces default
antivirus filters to remain attached.
Disabled: Disabling this setting turns off the ability to create and use Dev Drive
storage volumes.
There are a few ways to enable the Dev Drive feature and update Group Policy:
2. Create a profile:
a. Devices > Windows > Configuration profiles > Create profile
b. Select Platform > Windows 10 and later
c. Select Profile type > Settings catalog
3. Set a custom profile name and description.
5. Configure the Dev Drive policy settings, complete the remaining configuration of
Scope tags and Assignments, then select Create
Use Microsoft Configuration Manager to
update Group Policy for Dev Drive
To update Group Policy and enable Dev Drive using Microsoft Configuration Manager
(ConfigMgr, formerly MEMCM/SCCM), you can use the following PowerShell scripts.
(What is Configuration Manager?)
The Configuration Manager console has an integrated ability to run PowerShell scripts
to update Group Policy settings across all computers in your network.
1. Open the Microsoft Configuration Manager console. Select Software Library >
Scripts > Create Script.
2. Enter the script name (for example, Dev Drive demo), description (Demo
configuration to enable Dev Drive settings), language (PowerShell), timeout
seconds (180), and then paste in the following "Dev Drive demo" script example to
use as a template.
PowerShell
######
#ConfigMgr Management of Dev Drive
#Dev Drive is a new form of storage volume available to improve
performance for key developer workloads.
#Check Log File for enforcement status -
C:\Windows\temp\ConfigDevDrive-<TimeStamp>.log
######
Function Set-RegistryKeyValue{
param (
$KeyPath,
$ValueName,
$Value,
$PropertyType,
$LogFile
)
Try {
If (!(Test-path $KeyPath)) {
$Path = ($KeyPath.Split(':'))[1].TrimStart("\")
([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.Regi
stryHive]::LocalMachine,$env:COMPUTERNAME)).CreateSubKey($Path)
New-ItemProperty -path $KeyPath -name $ValueName -value $Value -
PropertyType $PropertyType -Force | Out-Null
}
Else {
New-ItemProperty -path $KeyPath -name $ValueName -value $Value -
PropertyType $PropertyType -Force | Out-Null
}
$TestValue = (Get-ItemProperty -Path $KeyPath)."$ValueName"
If ($TestValue -eq $Value){ Add-Content -Path $LogFile -Value
"$KeyPath,$ValueName,$Value,$PropertyType,$TestValue,Success" }
Else { Add-Content -Path $LogFile -Value
"$KeyPath,$ValueName,$Value,$PropertyType,$TestValue,Failure" }
}
Catch {
$ExceptionMessage = $($PSItem.ToString()) -replace
[Environment]::NewLine,"";
Add-Content -Path $LogFile -Value
"$KeyPath,$ValueName,$Value,$PropertyType,$TestValue,Failure -
$ExceptionMessage"
}
}
$ExecutionTime = Get-Date
$StartTime = Get-Date $ExecutionTime -Format yyyyMMdd-HHmmss
$LogFile = "C:\Windows\temp\ConfigDevDrive-$StartTime.log"
Add-Content -Path $LogFile -Value "------------------------------------
V 1.0 $ExecutionTime - Execution Starts -------------------------------
------------"
Add-Content -Path $LogFile -Value
"RegistryKeyPath,ValueName,ExpectedValue,PropertyType,CurrentValue,Comp
arisonResult"
#Set up a Dev Drive
Set-RegistryKeyValue -KeyPath
"HKLM:\System\CurrentControlSet\Policies\" -ValueName
"FsEnableDevDrive" -Value "1" -PropertyType "Dword" -LogFile $LogFile
Set-RegistryKeyValue -KeyPath
"HKLM:\System\CurrentControlSet\Policies\" -ValueName
"FltmgrDevDriveAllowAntivirusFilter" -Value "1" -PropertyType "Dword" -
LogFile $LogFile
Set-RegistryKeyValue -KeyPath
"HKLM:\System\CurrentControlSet\Policies\" -ValueName
"FltmgrDevDriveAttachPolicy" -Value "PrjFlt, MsSecFlt, WdFilter,
bindFlt, wcifs, FileInfo" -PropertyType "MultiString" -LogFile $LogFile
$ExecutionTime = Get-Date
Add-Content -Path $LogFile -Value "------------------------------------
$ExecutionTime - Execution Ends ---------------------------------------
----"
--------------------
3. When adding a new script, you must select and approve it. The approval state will
change from "Waiting for approval" to "Approved".
4. Once approved, right-click a single device or device collection and select Run
script.
5. On the script page of the Run Script wizard, choose your script from the list (Dev
Drive demo in our example). Only approved scripts are displayed. Select Next and
complete the wizard.
See Query policies with FsUtil to check that Group Policy settings were accurately
updated.
To learn more, see Create and run PowerShell scripts from the Configuration Manager
console.
To update this filter attach policy, select Dev Drive filter attach policy from the Local
Group Policy Editor in Windows Control Panel.
Query policies with FsUtil
FSUtil can be used to query the Group Policy configured for Dev Drive. Here is the
output from an FsUtil query for a Dev Drive Group Policy configured to:
PowerShell
Result:
PowerShell
This same query can be run on a specific Dev Drive to see the attached filters. To run the
command on a specific Dev Drive, enter the command:
PowerShell
Result:
PowerShell
Additional resources
Delivering continuous innovation in Windows 11 (Microsoft Support)
Developers who want to manage their software applications using the command
line.
Independent Software Vendors (ISVs) who want to distribute software.
Enteprise organizations who want to automate device set up and maintain a secure
work environment.
Ideally, developers use a package manager to specify the prerequisites for the tools they
need to develop solutions for a given project. The package manager then follows the
declarative instructions to install and configure the tools. The package manager reduces
the time spent getting an environment ready, and it helps ensure the same versions of
packages are installed on their machine.
Third party package managers can leverage the Microsoft Community Package Manifest
Repository to increase the size of their software catalog.
For more information, see Use the winget tool to install and manage applications.
To maintain ongoing security updates, the WinGet client is released using the Microsoft
Store and installs applications from the Microsoft Store using the “msstore” source and
applying “certificate pinning” to ensure that the connection is secure and established
with the proper endpoint.
The Group Policy applied by your enterprise organization may be using SSL inspection
via a firewall between the WinGet client and the Microsoft Store source that causes a
connection error to appear in the WinGet client.
For this reason, the Windows Package Manager desktop installer supports a policy
setting called: “BypassCertificatePinningForMicrosoftStore”. This policy controls whether
the Windows Package Manager will validate the Microsoft Store certificate hash matches
to a known Microsoft Store certificate when initiating a connection to the Microsoft
Store Source. The options for this policy include:
Not configured (default): If you do not configure this policy, the Windows Package
Manager administrator settings will be adhered to. We recommend leaving this
policy in the not configured default unless you have a specific need to change it.
Enable: If you enable this policy, the Windows Package Manager will bypass the
Microsoft Store certificate validation.
Disable: If you disable this policy, the Windows Package Manager will validate the
Microsoft Store certificate used is valid and belongs to the Microsoft Store before
communicating with the Microsoft Store source.
“Certificate Pinning” ensures that the package manager connection to the Microsoft
Store is secure, helping to avoid risks associated with attacks such as Man-in-the-Middle
(MITM) attacks involving a third party inserting themselves between a client (user) and
server (application) to secretly intercept communication flows to steal sensitive data
such as login credentials, etc. Disabling “Certificate Pinning” (enabling the bypass) can
expose your organization to risk in this area and should be avoided.
To learn more about setting up Group Policy for your enterprise organization, see the
Microsoft Intune documentation.
Related topics
Use the winget tool to install and manage software packages
Submit packages to Windows Package Manager
Use the winget tool to install and
manage applications
Article • 05/04/2023
The winget command line tool enables users to discover, install, upgrade, remove and
configure applications on Windows 10 and Windows 11 computers. This tool is the
client interface to the Windows Package Manager service.
Install winget
Windows Package Manager winget command-line tool is available on Windows 11 and
modern versions of Windows 10 as a part of the App Installer.
You can get App Installer from the Microsoft Store . If it's already installed, make sure it
is updated with the latest version.
7 Note
The winget command line tool is only supported on Windows 10 1709 (build
16299) or later at this time. The winget tool will not be available until you have
logged into Windows as a user for the first time, triggering Microsoft Store to
register Windows Package Manager as part of an asynchronous process. If you
have recently logged in as a user for the first time and find that winget is not yet
available, you can open PowerShell and enter the following command to request
this winget registration: Add-AppxPackage -RegisterByFamilyName -MainPackage
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe .
Download the latest winget preview version . Read the Release notes for winget
preview to learn about any new features. Installing this package will give you the
preview version of the WinGet client, but it will not enable automatic updates of
new preview versions from the Microsoft Store.
Use a Microsoft Account (MSA), work, school or Azure Active Directory (AAD)
account to sign up for the Windows Insider Dev Channel . The Windows Insider
Dev Channel includes automatic updates of new preview versions from the
Microsoft Store.
Use a Microsoft Account (MSA) to sign up for the Windows Package Manager
Insiders Program . Once your Microsoft Account (MSA) has been added (a few
days after you receive e-mail notification) you will receive automatic updates of
new preview versions from the Microsoft Store.
To install the stable release of winget on Windows Sandbox, follow these steps from a
Windows PowerShell command prompt:
PowerShell
$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri
https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile
Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-
xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile
Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
For more information on Windows Sandbox, including how to install a sandbox and
what to expect from it's usage, see the Windows Sandbox docs.
Administrator considerations
Installer behavior can be different depending on whether you are running winget with
administrator privileges.
When running winget in an Administrator Command Prompt, you will not see
elevation prompts if the application requires it. Always use caution when running
your command prompt as an administrator, and only install applications you trust.
Use winget
After App Installer is installed, you can run winget by typing 'winget' from a Command
Prompt.
One of the most common usage scenarios is to search for and install a favorite tool.
2. After you have confirmed that the tool you want is available, you can install the
tool by typing winget install <appname> . The winget tool will launch the installer
and install the application on your PC.
Some users have reported issues with the client not being on their PATH.
Commands
The current preview of the winget tool supports the following commands.
ノ Expand table
Command Description
info Displays metadata about the system (version numbers, architecture, log location,
etc). Helpful for troubleshooting.
source Adds, removes, and updates the Windows Package Manager repositories accessed
by the winget tool.
validate Validates a manifest file for submission to the Windows Package Manager
repository.
Options
The winget tool supports the following options.
ノ Expand table
Option Description
--info Provides you with all detailed information on winget, including the links to the
license, privacy statement, and configured group policies.
Scripting winget
You can use the following syntax to install multiple applications in a single command.
Example
CMD
7 Note
When scripted, winget will launch the applications in the specified order. When an
installer returns success or failure, winget will launch the next installer. If an installer
launches another process, it is possible that it will return to winget prematurely.
This will cause winget to install the next installer before the previous installer has
completed.
Missing tools
If the community repository does not include your tool or application, please submit a
package to our repository . By adding your favorite tool, it will be available to you and
everyone else.
The source for winget is contained in a Visual Studio 2019 C++ solution. To build the
solution correctly, install the latest Visual Studio with the C++ workload .
We encourage you to contribute to the winget source on GitHub. You must first agree
to and sign the Microsoft CLA.
Troubleshooting
The winget-cli repo maintains a list of common issues and common errors, along with
recommendations on how to resolve:
common issues -- not recognized, failed to run, App Installer version or PATH
variable need updating
common errors -- Error 0x801901a0, 0x80d03002, 0x80070490
The configure command of the winget tool uses a WinGet Configuration file to begin
setting up your Windows machine to a desired development environment state.
2 Warning
Do not run a WinGet Configuration file without first reviewing the contents of the
file and verifying the credibility of the related resources. See How to check the
trustworthiness of a WinGet Configuration file.
Prerequisites
Windows 10 RS5 or later, and Windows 11.
WinGet version v1.6.2631 or later .
Aliases
The following aliases are available for this command:
configuration
Usage
winget configure -f <C:/Users/<username>/winget-configs/config-file-name.dsc.yaml>
Once you have identified the winget configuration file that you are interested in using,
confirmed the safety and trustworthiness of that file, and downloaded the file to your
local machine, you can use the winget configure command to initiate the set up of your
configuration.
Argument Description
configure subcommands
The winget configure command includes a number of subcommands, including:
winget configure show : Displays the details of a configuration file. Usage: winget
configure show -f <C:/Users/<username>/winget-configs/config-file-
whether the current system state conforms with the desired state defined in the
associated configuration file. Usage: winget configure test -f
<C:/Users/<username>/winget-configs/config-file-name.dsc.yaml> .
winget configure validate : Validates a configuration file. Usage: winget configure
Related topics
WinGet Configuration overview
How to author a WinGet Configuration file
How to check the trustworthiness of a WinGet Configuration file
Use the winget tool to install and manage applications
Submit packages to Windows Package Manager
download command (winget)
Article • 11/16/2023
The download command of the winget tool downloads the installer from the selected
package. Use the search command and the show command to identify the package
installer you want to download .
The download command requires that you specify the exact string to download. If there
is any ambiguity, you will be prompted to further filter the download command to an
exact application.
7 Note
By default, the download command will download the appropriate installer to the
user's Downloads folder. Use the --download-directory option to specify a custom
download path.
7 Note
As of March 2024, the download option does not support the msstore source.
Usage
winget download [[-q] <query>] [\<options>]
Arguments
The following arguments are available.
ノ Expand table
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to uniquely identify the package you
wish to download.
Options
The options allow you to customize the download experience to meet your needs.
ノ Expand table
Option Description
-m, --manifest Must be followed by the path to the manifest (YAML) file.
--moniker Limits the search to the moniker listed for the application.
-v, --version Enables you to specify an exact version to install. If not specified, latest
will download the highest versioned application.
-s, --source Restricts the search to the source name provided. Must be followed by
the source name.
--scope Allows you to specify if the installer should target user or machine scope.
See known issues relating to package installation scope.
-e, --exact Uses the exact string in the query, including checking for case-sensitivity.
It will not use the default behavior of a substring.
-o, --log Directs the logging to a log file. You must provide a path to a file that you
have the write rights to.
--accept-package- Used to accept the license agreement, and avoid the prompt.
agreements
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Option Description
Example queries
The following example downloads a specific version of an application from its ID.
CMD
CMD
CMD
Related topics
Use the winget tool to install and manage applications
Submit packages to Windows Package Manager
The export command of the winget tool exports a JSON file of apps to a specified file.
The export command uses JSON as the format. You can find the schema for the JSON
file used by winget in the Windows Package Manager Client repo on GitHub .
The export combined with the import command allows you to batch install applications
on your PC.
The export command is often used to create a file that you can share with other
developers, or for use when restoring your build environment.
Usage
winget export [-o] <output> [<options>]
Arguments
The following arguments are available.
Argument Description
Option Description
-s, --source [Optional] Specifies a source to export files from. Use this option when you
only want files from a specific source.
--include-versions [Optional] Includes the version of the app currently installed. Use this
option if you want a specific version. By default, unless specified, import will
use latest.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
JSON schema
The driving force behind the export command is the JSON file. You can find the schema
for the JSON file in the Windows Package Manager Client repo on GitHub .
Entry Description
PackageIdentifier The Windows Package Manager package identifier used to specify the
package.
Exporting files
When the Windows Package Manager exports the JSON file, it attempts to export all the
applications installed on the PC. If the winget export command is not able to match an
application to an application from an available source, the export command will show a
warning.
7 Note
After the export is complete, you can edit the resulting JSON file in your favorite editor.
You can remove apps you do not wish to import in the future.
Related topics
Use the winget tool to install and manage applications
features command (winget)
Article • 07/26/2023
The features command of the winget tool displays a list of the experimental features
available with your version of the Windows Package Manager. Experimental features are
only available in preview builds. Instructions for obtaining a preview build can be found
in the GitHub repository .
Each feature can be turned on individually by enabling the features through settings.
You can find the latest up to date information features on the experimental features
web page.
Usage
winget features
Notice above that the status of each feature is listed. If the feature is disabled you will
not be able to use it. If the feature is enabled you will notice that the command will be
available to you through winget.
Features may be managed by group policy. You can use the winget --info
command to view any policies in effect on your system.
hash command (winget)
Article • 07/28/2023
The hash command of the winget tool generates the SHA256 hash for an installer. This
command is used if you need to create a manifest file for submitting software to the
Microsoft Community Package Manifest Repository on GitHub.
In addition, the hash command also supports generating a SHA256 certificate hash for
MSIX files.
Usage
winget hash [--file] \<file> [\<options>]
The hash sub-command can only run on a local file. To use the hash sub-command,
download your installer to a known location. Then pass in the file path as an argument
to the hash sub-command.
Arguments
The following arguments are available:
Argument Description
Options
The options allow you to customize the hash experience to meet your needs.
Option Description
-m,--msix Specifies that the hash command will also create the SHA-256
SignatureSha256 for use with MSIX installers.
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Related topics
Use the winget tool to install and manage applications
Submit packages to Windows Package Manager
help command (winget)
Article • 11/01/2021
The help command of the winget tool displays help for all the supported commands
and sub commands. In addition, you can pass the --help argument to any other
command to get details about all additional command options.
Usage
Display help for all commands: winget --help or winget -?
View options for a command: winget <command> --help or winget <command> -?
Related topics
Use the winget tool to install and manage applications
import command (winget)
Article • 07/28/2023
The import command of the winget tool imports a JSON file of apps to install. The
import command combined with the export command allows you to batch install
applications on your PC.
The import command is often used to share your developer environment or build up
your PC image with your favorite apps.
Usage
winget import [-i] <import-file> [<options>]
Arguments
The following arguments are available.
Argument Description
Options
The options allow you to customize the import experience to meet your needs.
Option Description
--ignore-versions Ignores versions specified in the JSON file and installs the latest
available version.
--accept-package- Used to accept the license agreement, and avoid the prompt.
agreements
--accept-source- Used to accept the source license agreement, and avoid the
agreements prompt.
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
JSON Schema
The driving force behind the import command is the JSON file. You can find the schema
for the JSON file in the Windows Package Manager Client repo on GitHub .
Entry Description
PackageIdentifier The Windows Package Manager package identifier used to specify the
package.
Importing files
When the Windows Package Manager imports the JSON file, it attempts to install the
specified applications in a serial fashion. If the application is not available or the
application is already installed, it will notify the user of that case.
The info command of the winget tool displays metadata about the system, including
version numbers, system architecture, log location, links to legal agreements, and Group
Policy state.
Usage
winget --info
Related topics
Use the winget tool to install and manage applications
install command (winget)
Article • 11/15/2023
The install command of the winget tool installs the specified application. Use the search
command to identify the application you want to install.
The install command requires that you specify the exact string to install. If there is any
ambiguity, you will be prompted to further filter the install command to an exact
application.
Usage
winget install [[-q] \<query> ...] [\<options>]
Aliases
The following aliases are available for this command:
add
Arguments
The following arguments are available.
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to uniquely identify the package you
wish to install.
Options
The options allow you to customize the install experience to meet your needs.
Option Description
-m, --manifest Must be followed by the path to the manifest (YAML) file. You can use
the manifest to run the install experience from a local YAML file.
--moniker Limits the search to the moniker listed for the application.
-v, --version Enables you to specify an exact version to install. If not specified, latest
will install the highest versioned application.
-s, --source Restricts the search to the source name provided. Must be followed by
the source name.
--scope Allows you to specify if the installer should target user or machine
scope. See known issues relating to package installation scope.
--installer-type Select the installer type to install. See supported installer types for
WinGet client.
-e, --exact Uses the exact string in the query, including checking for case-
sensitivity. It will not use the default behavior of a substring.
-i, --interactive Runs the installer in interactive mode. The default experience shows
installer progress.
-h, --silent Runs the installer in silent mode. This suppresses all UI. The default
experience shows installer progress.
Option Description
-o, --log Directs the logging to a log file. You must provide a path to a file that
you have the write rights to.
--accept-package- Used to accept the license agreement, and avoid the prompt.
agreements
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--force Direct run the command and continue with non security related issues.
--verbose, --verbose- Used to override the logging setting and create a verbose log.
logs
Example queries
The following example installs a specific version of an application.
CMD
CMD
CMD
Multiple selections
If the query provided to winget does not result in a single application, then winget will
display the results of the search. This will provide you with the additional data necessary
to refine the search for a correct install.
The best way to limit the selection to one file is to use the id of the application
combined with the exact query option. For example:
CMD
CMD
The msstore source uses unique identifiers as the "Id" for packages. These do not
require the exact query toption. For example:
CMD
Option Description
7 Note
Installing packages from local manifest files may have risks. As an extra measure of
precaution this feature needs to be enabled by an administrator. To enable this
feature run winget settings --enable LocalManifestFiles . To disable this feature
run winget settings --disable LocalManifestFiles .
Log files
The log files for winget unless redirected, will be located in the following folder:
%temp%\AICLI\*.log
License Agreements
Some applications when installed will require the user to agree to the license or other
agreements before installing. When this occurs, the Windows Package Manager will
prompt the user to agree to the agreements. If the user does not agree, the application
will not install.
From the command line, you can auto accept the agreements by passing the following
option --accept-package-agreements on the command line. This can be beneficial
when scripting the Windows Package Manager.
Related topics
Use the winget tool to install and manage applications
list command (winget)
Article • 07/28/2023
The list command of the winget tool displays a list of the applications currently installed
on your computer. The list command will show apps that were installed through the
Windows Package Manager as well as apps that were installed by other means.
The list command will also display if an update is available for an app, and you can use
the upgrade command to update the app.
The list command also supports filters which can be used to limit your list query.
Aliases
The following aliases are available for this command:
ls
Usage
winget list [[-q] \<query>] [\<options>]
7 Note
If you want to list all apps with available updates use winget upgrade (without any
arguments).
Arguments
The following arguments are available.
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to help find the installed package
you are searching for.
Options
The options allow you to customize the list experience to meet your needs.
Option Description
--moniker Limits the list to the moniker listed for the application.
-s, --source Restricts the list to the source name provided. Must be followed by the
source name.
-e, --exact Uses the exact string in the list query, including checking for case-
sensitivity. It will not use the default behavior of a substring.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Example queries
The following example lists a specific version of an application.
In the image below, you will notice the preview version of Terminal has an update
available.
The list command will show not only the update version available, but the source that
the update is available from.
If there are no updates available, list will only show you the currently installed version
and the update column will not be displayed.
The winget pin command allows you to limit the Windows Package Manager from
upgrading a package to specific ranges of versions, or it can prevent it from upgrading a
package altogether. A pinned package may still upgrade on its own and be upgraded
from outside the Windows Package Manager.
Pin Types
WinGet supports three types of package pins:
Pinning: The package is excluded from winget upgrade --all but allows winget
upgrade <package> . You can use the --include-pinned argument to let winget
Blocking: The package is blocked from winget upgrade --all or winget upgrade
<package> , you will have to unpin the package to let WinGet perform an upgrade.
Gating: The package is pinned to a specific version or version range. You can
specify an exact version you want a package to be pinned to or you can utilize the
wildcard character * as the last version part to specify a version range. For
example, if a package is pinned to version 1.2.* , any version between 1.2.0 to
1.2.x is considered valid. The --force option can be used to override the pin's
behavior.
Usage
Windows Command Prompt
Options
The following options are available.
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Subcommands
The pin command supports the following subcommands.
Subcommand Description
add
The add subcommand adds a new pin. This subcommand requires that you specify the
exact package to pin. If there is any ambiguity, you will be prompted to further filter the
add subcommand to an exact application.
Usage:
Arguments
Argument Description
Option Description
--moniker Limits the search to the moniker listed for the application.
--tag Limits the search to the tag listed for the application.
-v, --version Enables you to specify an exact version to pin. The wildcard * can be used
as the last version part. Changes pin behavior to be gating.
-s, --source Restricts the search to the source name provided. Must be followed by the
source name.
-e, --exact Uses the exact string in the query, including checking for case-sensitivity.
It will not use the default behavior of a substring.
--force Direct run the command and continue with non security related issues.
--blocking Block from upgrading until the pin is removed, preventing override
arguments. Changes pin behavior to be blocking.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Examples
The following example adds a pin for an application. Adding this pin will prevent this
package from being upgraded when calling winget upgrade --all . Use the --include-
pinned argument with winget upgrade --all to include any pinned packages.
The following example adds a blocking pin for an application using its ID. Adding a
blocking pin will prevent this package from being upgraded when calling winget
upgrade --all or winget upgrade <package> . You will need to unblock the package to let
The following example adds a gating pin for an application using its ID. Adding a gating
pin will prevent upgrades that upgrade the package version outside of a specific version
or the gated wildcard range.
remove
The remove subcommand removes a pin. This subcommand requires that you specify
the exact package pin to remove. If there is any ambiguity, you will be prompted to
further filter the remove subcommand to an exact application.
Usage:
Arguments
Argument Description
Options
The options allow you to customize removing pins to meet your needs.
Option Description
--moniker Limits the search to the moniker listed for the application.
--tag Limits the search to the tag listed for the application.
-s, --source Restricts the search to the source name provided. Must be followed by
the source name.
-e, --exact Uses the exact string in the query, including checking for case-sensitivity.
It will not use the default behavior of a substring.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Examples
The following example removes a pin for an application.
Windows Command Prompt
The following example removes a pin for an application using its ID.
list
The list subcommand lists all current pins.
Usage:
Arguments
Argument Description
Options
The options allow you to customize listing pins to meet your needs.
Option Description
--moniker Limits the search to the moniker listed for the application.
--tag Limits the search to the tag listed for the application.
-s, --source Restricts the search to the source name provided. Must be followed by
the source name.
Option Description
-e, --exact Uses the exact string in the query, including checking for case-sensitivity.
It will not use the default behavior of a substring.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Examples
The following example lists all current pins.
reset
The reset subcommand resets all pins.
Using this subcommand without the --force argument will show the pins that would be
removed.
Usage:
The following example shows all pins that would be reset.
The search command of the winget tool can be used to show all applications available
for installation. It can also be used to identify the string or ID needed to install a specific
application.
For example, the command winget search vscode will return all applications available
that include "vscode" in the description or tag.
The search command includes parameters for filtering down the applications returned
to help you identify the specific application you are looking for, including: --id , --name ,
--moniker , --tag , --command , or --source . See descriptions below or use winget search
--help in your command line.
Usage
winget search [[-q] \<query>] [\<options>]
Aliases
The following aliases are available for this command:
find
Arguments
The following arguments are available.
Argument Description
-q,--query The query flag is the default argument used to search for an app. It does not need to
be specified. Entering the command winget search foo will default to using --query
so including it is unnecessary.
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to help find the package you are
searching for.
Show all
To show all of the winget packages available, use the command:
In PowerShell, you will need to escape the quotes, so this command becomes:
PowerShell
7 Note
This is a change from previous versions of winget which supported winget search
with no filters or options displaying all available packages. You can also search for
all applications in another source by passing in the source option.
Search strings
Search strings can be filtered with the following options.
Option Description
--id Limits the search to the ID of the application. The ID includes the
publisher and the application name.
--tag Limits the search to the tags listed for the application.
--cmd, --command Limits the search to the commands listed for the application.
-n, --count Show no more than specified number of results (between 1 and 1000).
-e, --exact Uses the exact string in the query, including checking for case-sensitivity.
It will not use the default behavior of a substring.
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
The string will be treated as a substring. The search by default is also case insensitive.
For example, winget search micro could return the following:
Microsoft
Microscope
MyMicro
Related topics
Use the winget tool to install and manage applications
settings command (winget)
Article • 08/03/2022
The settings command of the winget tool allows you to customize your Windows
Package Manager client experience. You can change defaults and try out experimental
features that are enabled in your client.
The settings command will launch your default text editor. Windows by default will
launch Notepad as an option. We recommend using a tool like Visual Studio code .
7 Note
You can easily install Visual Studio Code by typing winget install
Microsoft.VisualStudioCode
Aliases
The following aliases are available for this command:
config
When you launch the settings for the first time, there will be no settings specified. At the
top of the JSON file we provide a link where you can discover the latest experimental
features and settings.
The code snippet below is an example of what your settings file should look like if you
would like to enable or modify some of these experimental features and settings.
JSON
{
"$schema": "https://aka.ms/winget-settings.schema.json",
We have also defined a schema for the settings file. This allows you to use TAB to
discover settings and syntax if your JSON editor supports JSON schemas.
7 Note
Experimental features are only available in preview builds. Instructions for obtaining
a preview build can be found in the GitHub repository .
Updating settings
The following settings are available for the 1.0 release of the Windows Package
Manager.
source settings
The source settings involve configuration to the WinGet source.
JSON
"source": {
"autoUpdateIntervalInMinutes": 3
},
autoUpdateIntervalInMinutes
A positive integer represents the update interval in minutes. The check for updates only
happens when a source is used. A zero will disable the check for updates to a source.
Any other values are invalid.
Disable: 0
Default: 5
JSON
"visual": {
"progressBar": "accent"
},
progressBar
Color of the progress bar that WinGet displays when not specified by arguments.
accent (default)
retro
rainbow
installBehavior settings
The installBehavior settings affect the default behavior of installing and upgrading
(where applicable) packages.
disableInstallNotes
The disableInstallNotes behavior affects whether installation notes are shown after a
successful install. Defaults to false if value is not set or is invalid.
JSON
"installBehavior": {
"disableInstallNotes": true
},
portablePackageUserRoot setting
The portablePackageUserRoot setting affects the default root directory where packages
are installed to under User scope. This setting only applies to packages with the
portable installer type. Defaults to %LOCALAPPDATA%/Microsoft/WinGet/Packages/ if value
JSON
"installBehavior": {
"portablePackageUserRoot": "C:/Users/FooBar/Packages"
},
portablePackageMachineRoot setting
The portablePackageMachineRoot setting affects the default root directory where
packages are installed to under Machine scope. This setting only applies to packages
with the portable installer type. Defaults to %PROGRAMFILES%/WinGet/Packages/ if value is
not set or is invalid.
JSON
"installBehavior": {
"portablePackageMachineRoot": "C:/Program Files/Packages/Portable"
},
The preferences setting affects how the various available options are sorted when
choosing the one to act on. For example, the default scope of package installs is
for the current user, but if that is not an option then a machine level installer will
be chosen.
The requirements setting filters the options, potentially resulting in an empty list
and a failure to install. In the previous example, a user scope requirement would
result in no applicable installers and an error.
Any arguments passed on the command line will effectively override the matching
requirement setting for the duration of that command.
scope
The scope behavior affects the choice between installing a package for the current user
or for the entire machine. The matching parameter is --scope , and uses the same values
( user or machine ). See known issues relating to package installation scope.
JSON
"installBehavior": {
"preferences": {
"scope": "user"
}
},
locale
The locale behavior affects the choice of installer based on installer locale. The
matching parameter is --locale , and uses bcp47 language tag.
JSON
"installBehavior": {
"preferences": {
"locale": [ "en-US", "fr-FR" ]
}
},
architectures
The architectures behavior affects what architectures will be selected when installing a
package. The matching parameter is --architecture . Note that only architectures
compatible with your system can be selected.
JSON
"installBehavior": {
"preferences": {
"architectures": ["x64", "arm64"]
}
},
installerTypes
The installerTypes behavior affects what installer types will be selected when installing
a package. The matching parameter is --installer-type .
JSON
"installBehavior": {
"preferences": {
"installerTypes": ["msix", "msi"]
}
},
uninstallBehavior
The uninstallBehavior settings affect the default behavior of uninstalling (where
applicable) packages.
purgePortablePackage
The purgePortablePackage behavior affects the default behavior for uninstalling a
portable package. If set to true , uninstall will remove all files and directories relevant to
the portable package. This setting only applies to packages with the portable installer
type. Defaults to false if value is not set or is invalid.
JSON
"uninstallBehavior": {
"purgePortablePackage": true
},
downloadBehavior
The downloadBehavior settings affect the default behavior of downloading packages.
defaultDownloadDirectory
The defaultDownloadDirectory setting affects the default directory where packages are
downloaded to. Defaults to %USERPROFILE%/Downloads if value is not set or is invalid.
JSON
"downloadBehavior": {
"defaultDownloadDirectory": "C:/Users/FooBar/Downloads"
},
telemetry settings
The telemetry settings control whether winget writes ETW events that may be sent to
Microsoft on a default installation of Windows.
disable
JSON
"telemetry": {
"disable": true
},
If set to true, the telemetry.disable setting will prevent any event from being written by
the program.
network settings
The network settings influence how winget uses the network to retrieve packages and
metadata.
downloader
The downloader setting controls which code is used when downloading packages. The
default is default , which may be any of the options based on our determination.
wininet uses the WinINet APIs, while do uses the Delivery Optimization service.
JSON
"network": {
"downloader": "do"
}
logging settings
The logging settings control the level of detail in log files. --verbose-logs will override
this setting and always creates a verbose log.
JSON
"logging": {
"level": "verbose"
}
level
The following logging levels are available. Defaults to info if the value is not set or is
invalid.
verbose
info
warning
error
critical
The show command of the winget tool displays details for the specified application,
including details on the source of the application as well as the metadata associated
with the application.
The show command only shows metadata that was submitted with the application. If
the submitted application excludes some metadata, then the data will not be displayed.
Aliases
The following aliases are available for this command:
view
Usage
winget show [[-q] \<query>] [\<options>]
Arguments
The following arguments are available.
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to help find the package you are
searching for.
Options
The following options are available.
Option Description
-v,--version Use the specified version. The default is the latest version.
--installer-type Select the installer type to show. See supported installer types for
WinGet client.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Multiple selections
If the query provided to winget does not result in a single application, then winget will
display the results of the search. This will provide you with the additional data necessary
to refine the search.
Results of show
If a single application is detected, the following data will be displayed.
Metadata
Value Description
Installer details
Value Description
Related topics
Use the winget tool to install and manage applications
The winget source command
Article • 07/28/2023
The winget tool source command allows you to manage sources for Windows Package
Manager. With the source command, you can add, list, update, remove, reset, or export
repositories.
A source repository provides the data for you to discover and install applications. Only
use secure, trusted source locations.
Windows Package Manager specifies the following two default repositories, which you
can list by using winget source list .
Usage
Windows Command Prompt
Arguments
The following arguments are available.
Argument Description
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Subcommands
The source command supports the following subcommands.
Subcommand Description
add
The add subcommand adds a new source. This subcommand requires the --name and -
-arg options. Because the command changes user access, using add requires
administrator privileges.
Usage:
winget source add [-n, --name] <name> [-a, --arg] <url> [[-t, --type]
<type>]
Arguments
Argument Description
Options
Option Description
--accept-source- Used to accept the source license agreement, and avoid the
agreements prompt.
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
The add subcommand supports the optional type parameter, which tells the client what
type of repository it is connecting to. The following type is supported.
Type Description
list
The list subcommand enumerates the currently enabled sources, or provides details on
a specific source.
Usage:
Aliases
The following aliases are available for this subcommand:
ls
Arguments
Argument Description
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
list all
The list subcommand by itself, winget source list , provides the complete list of
supported sources:
Output
Name Arg
-----------------------------------------
winget https://winget.azureedge.net/cache
Output
Name : Contoso
Type : Microsoft.PreIndexed.Package
Arg : https://pkgmgr-int.azureedge.net/cache
Data : AppInstallerSQLiteIndex-int_g4ype1skzj3jy
Updated: 2020-4-14 17:45:32.000
Name is the name of the source.
Type is the type of repo.
Updated is the last date and time the source was updated.
update
The update subcommand forces an update to an individual source, or to all sources.
Usage:
Aliases
refresh
Arguments
The following arguments are available.
Argument Description
Options
The following options are available.
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Option Description
update all
The update subcommand by itself, winget source update , requests updates to all repos.
update source
The update subcommand with the --name option directs an update to the named
source. For example: winget source update --name Contoso forces an update to the
Contoso repository.
remove
The remove subcommand removes a source. This subcommand requires the --name
option to identify the source. Because the command changes user access, using remove
requires administrator privileges.
Usage:
Aliases
The following aliases are available for this subcommand:
rm
Arguments
Argument Description
Options
The following options are available.
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Examples
reset
The reset subcommand resets the client back to its original configuration, and removes
all sources except the default. Only use this subcommand in rare cases. Because the
command changes user access, using reset requires administrator privileges.
Because the reset command removes all sources, you must force the action by using the
--force option.
Usage:
Arguments
Argument Description
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
export
The export sub-command exports the specific details for a source to JSON output.
Arguments
The following arguments are available.
Argument Description
Options
The following options are available.
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Examples
Windows Command Prompt
Output
{"Arg":"https://winget.azureedge.net/cache","Data":"Microsoft.Winget.Source_
8wekyb3d8bbwe","Identifier":"Microsoft.Winget.Source_8wekyb3d8bbwe","Name":"
winget","Type":"Microsoft.PreIndexed.Package"}
Source agreement
An individual source might request that the user agree to the terms presented before
adding or using the repository. If a user doesn't accept or acknowledge the agreement,
they won't be able to access the source.
You can use the --accept-source-agreements option to accept the source license
agreement and avoid the prompt.
Related topics
Use the winget tool to install and manage applications
Tab completion (winget)
Article • 05/19/2022
The winget command line tool offers a complete command to provide context-sensitive
tab completion. It supports completion of command names, argument names, and
argument values, dependent on the current command line state.
1. Open PowerShell and enter the following command to open your $PROFILE in
Notepad: notepad.exe $PROFILE
2. Copy and paste the following script into the $PROFILE file that has opened in
Notepad:
PowerShell
3. Save the $PROFILE with your script. Then close and reopen PowerShell. Once
PowerShell has been reopened, winget tab completion will be enabled.
winget sh⇥ winget show show is the first command that starts with
sh
winget source l⇥ winget source list list is the first sub-command of source
that starts with l
winget install winget install "Power "Power Toys" is the first package whose Id,
power⇥ Toys" Name, or Moniker starts with power
winget install "Power winget install "Power 0.19.2 is the highest version of Power Toys
Toys" --version ⇥ Toys" --version 0.19.2 at the time of writing
Command Reference
The complete command takes 3 required arguments:
Argument Description
--word The current word that is being completed; the token that the cursor is located
within. Can be empty to indicate no current value at the cursor, but if provided, it
must appear as a substring in the command line.
-- The entire current command line, including winget . See the examples above;
commandline everything but the tab character ( ⇥ ) should be provided to this argument.
--position The current position of the cursor in the command line. Can be greater than the
length of the command line string to indicate at the end.
When a word value is provided, the completion operates in replacement mode. It will
suggest completions that would fit correctly at this location that also start with the given
word value.
When a word value is not provided (an empty value is provided for word, ex. --word= ),
the completion operates in insertion mode. It will suggest completions that would fit as
a new value in the cursor's location.
After evaluating all of these cases, the potential completions are output, one on each
line. If the completion string contains a space, it is wrapped in quotations.
Related topics
Use the winget tool to install and manage applications
Submit packages to Windows Package Manager
uninstall command (winget)
Article • 07/28/2023
The uninstall command of the winget tool uninstalls the specified application.
The uninstall command requires that you specify the exact string to uninstall. If there is
any ambiguity, you will be prompted to further filter the uninstall command to an exact
application.
Aliases
The following aliases are available for this command:
remove
rm
Usage
winget uninstall [[-q] \<query>] [\<options>]
7 Note
When using WinGet to uninstall a package, you may encounter a Microsoft Store
agreement. This is due to the way in which WinGet queries package manifest
sources. If you prefer not to have the Microsoft Store policy popup when
uninstalling, you can pass in --source winget to suppress the agreement.
Alternatively, you can uninstall using Start > Settings > Apps > Apps & features,
finding the app you want to remove, and selecting More > Uninstall.
Arguments
The following arguments are available.
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to help find the package you are
uninstalling.
Options
The options allow you to customize the uninstall experience to meet your needs.
Option Description
-m, --manifest Must be followed by the path to the manifest (YAML) file. You can use the
manifest to run the uninstall experience from a local YAML file.
--moniker Limits the search to the moniker listed for the application.
-v, --version Enables you to specify an exact version to uninstall. If not specified, latest
will uninstall the highest versioned application.
-s, --source Restricts the search to the source name provided. Must be followed by the
source name.
-e, --exact Uses the exact string in the query, including checking for case-sensitivity. It
will not use the default behavior of a substring.
-i, --interactive Runs the uninstaller in interactive mode. The default experience shows
uninstaller progress.
-h, --silent Runs the uninstaller in silent mode. This suppresses all UI. The default
experience shows uninstaller progress.
--force Direct run the command and continue with non security related issues.
--purge Deletes all files and directories in the package directory (portable)
--preserve Retains all files and directories created by the package (portable)
-o, --log Directs the logging to a log file. You must provide a path to a file that you
have the write rights to.
--accept-source- Used to accept the source license agreement, and avoid the prompt.
agreements
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
After you have successfully identified the application intended to uninstall, winget will
execute the uninstall command. In the example below, the name 'orca' and the id was
passed in.
Example queries
The following example uninstalls a specific version of an application.
CMD
winget uninstall --name powertoys --version 0.15.2
CMD
Multiple selections
If the query provided to winget does not result in a single application to uninstall, then
winget will display multiple results. You can then use additional filters to refine the
search for a correct application.
In this example, list was used to find the application, and then the id was passed in as
part of uninstall.
upgrade command (winget)
Article • 11/16/2023
The upgrade command of the winget tool upgrades the specified application.
Optionally, you may use the list command to identify the application you want to
upgrade.
The upgrade command requires that you specify the exact string to upgrade. If there is
any ambiguity, you will be prompted to further filter the upgrade command to an exact
application.
Aliases
The following aliases are available for this command:
update
Usage
winget upgrade [[-q] \<query> ...] [\<options>]
Arguments
The following arguments are available.
ノ Expand table
Argument Description
7 Note
The query argument is positional. Wild-card style syntax is not supported. This is
most often the string of characters you expect to help find the package you are
upgrading.
Options
The options allow you to customize the upgrade experience to meet your needs.
ノ Expand table
Option Description
-m, -- Must be followed by the path to the manifest (YAML) file. You can use the
manifest manifest to run the upgrade experience from a local YAML file.
--moniker Limits the search to the moniker listed for the application.
-v, --version Enables you to specify an exact version to upgrade. If not specified, latest will
upgrade the highest versioned application.
-s, --source Restricts the search to the source name provided. Must be followed by the
source name.
-e, --exact Uses the exact string in the query, including checking for case-sensitivity. It will
not use the default behavior of a substring.
-i, -- Runs the installer in interactive mode. The default experience shows installer
interactive progress.
-h, --silent Runs the installer in silent mode. This suppresses all UI. The default experience
shows installer progress.
--purge Deletes all files and directories in the package directory (portable)
Option Description
-o, --log Directs the logging to a log file. You must provide a path to a file that you have
the write rights to.
--installer- Select the installer type to upgrade. See supported installer types for WinGet
type client.
--ignore- Ignore the malware scan performed as part of installing an archive type package
local-archive- from local manifest.
malware-scan
--accept- Used to accept the license agreement, and avoid the prompt.
package-
agreements
--accept- Used to accept the source license agreement, and avoid the prompt.
source-
agreements
--uninstall- Uninstall the previous version of the package during upgrade. Behavior will
previous depend on the individual package. Some installers are designed to install new
Option Description
--force Direct run the command and continue with non security related issues.
--verbose, -- Used to override the logging setting and create a verbose log.
verbose-logs
Example queries
The following example upgrades a specific version of an application.
CMD
CMD
CMD
In the example below, you will see winget upgrade shows the user which apps have an
available update. From the available updates, the user identifies that an update is
available for JanDeDobbeleer.OhMyPosh and uses upgrade to update the application.
The example below shows the list command being used to identify that an update is
available for Microsoft.WindowsTerminalPreview. The user then uses upgrade to update
the application.
upgrade --all
upgrade --all will identify all the applications with upgrades available. When you run
winget upgrade --all the Windows Package Manager will look for all applications that
have updates available and attempt to install the updates.
7 Note
Some applications do not provide a version. They are always latest. Because the
Windows Package Manager cannot identify if there is a newer version of the app,
an upgrade will not be possible.
upgrade --uninstall-previous
upgrade --uninstall-previous will uninstall the previous version prior to installing the
newer version of the package. When using --uninstall-previous , the behavior will
depend on the individual package. Some installers are designed to install new versions
side-by-side while other installers include a manifest that specifies uninstallPrevious as
their default upgrade behavior (so earlier versions are uninstalled without needing to
use the command flag).
If the package manifest does not include uninstallPrevious as the upgrade behavior
and the --uninstall-previous flag is not used with the upgrade command, then the
default behavior for the installer will apply.
validate command (winget)
Article • 07/28/2023
The validate command of the winget tool validates a manifest for submitting software
to the Microsoft Community Package Manifest Repository on GitHub. The manifest
must be a YAML file that follows the specification .
Usage
winget validate [--manifest] \<path>
Arguments
The following arguments are available.
Argument Description
Options
The options allow you to customize the validate experience to meet your needs.
Option Description
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
Related topics
Use the winget tool to install and manage applications
Submit packages to Windows Package Manager
Debugging and troubleshooting issues
with the winget tool
Article • 09/01/2023
WinGet Logs
Windows Package Manager by default creates log files when executing commands.
These logs contain information that can aid in debugging issues with WinGet. There is
no maximum size for the log files. They are typically only a few KB in size. When the
number of log files in the directory exceeds 100, the oldest log files will begin being
deleted. There is no time-based removal of logs and these settings are not configurable.
If you have reached the 100 file log capacity, just move any WinGet logs that you wish
to preserve into a different directory.
Use the command winget --info to find the directory path to your WinGet log files. The
default path for WinGet log files is:
CMD
%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalSta
te\DiagOutputDir
You can include the --logs or --open-logs option to any command to open the logs
directory after the command completes. Here are some examples of using the --logs
option:
CMD
--verbose-logs
If you need more comprehensive log files, that provide the complete communication
with the CDNs and sources, include --verbose or --verbose-logs on the command line
as well. Here are some examples of using the --verbose-logs option:
CMD
Known issues
A list of known issues with sources and behaviors is kept up to date in the Windows
Package Manager Client repository . If you encounter issues when using the winget
tool, go here for troubleshooting.
Exit codes
The winget tool returns exit codes to indicate success or failure of the command. Find a
table of exit codes and their meanings in the "Return codes" file of the Windows
Package Manager Client repository .
See more details on scope-related issues in the WinGet product repository on GitHub.
WinGet Configuration
Article • 10/23/2023
Using a WinGet Configuration file, you can consolidate manual machine setup and
project onboarding to a single command that is reliable and repeatable. To achieve this,
WinGet utilizes:
A YAML-formatted WinGet Configuration file that lists all of the software versions,
packages, tools, dependencies, and settings required to set up the desired state of
the development environment on your Windows machine.
PowerShell Desired State Configuration (DSC) to automate the configuration of
your Windows operating system.
The Windows Package Manager winget configure command to initiate the
configuration process.
Unattended setup: Enter the winget configure command and let Windows
Package Manager and PowerShell DSC automate the installation and set up of all
the requirements needed to get the desired development environment configured
on your Windows machine.
Reliable and repeatable: Remove the worry over finding the right versions of
software, packages, tools, frameworks, and configuring the correct machine
settings for your development environment when onboarding to a new team or
project because they are pre-defined in the WinGet Configuration file using a
YAML format (with a JSON schema).
Supports Open Source collaboration: WinGet Configuration files can be hosted in
a GitHub repository where issues or contributions can be filed or can be kept
private in a secure storage location (like OneDrive) and shared via private email or
other secured channels.
2 Warning
WinGet Configuration files and any associated PowerShell DSC Resources should be
checked to ensure that they are trustworthy before applying them.
Use a WinGet Configuration file to configure
your machine
To set up your machine using a WinGet Configuration file, you can:
2. Use winget configure in the command line. To use the winget configure
command, you must be running WinGet version v1.6.2631 or later .
WinGet will parse the configuration file to ensure it's valid, then download all associated
PowerShell modules (containing the DSC resources) required to achieve your desired
state. Once these resources have been download and you've checked the
trustworthiness of the WinGet Configuration file, agreeing that you've verified the safety
of the file, WinGet will begin testing all required assertions and applying the desired
state.
The sequence in which the WinGet Configuration file resources are ordered is
inconsequential. Some install and configuration processes may even run in parallel. The
assertions directly correspond with the dependsOn field defined in each Resource. If the
resource includes a dependency on an assertion, the assertion will be checked first. If
the assertion fails, the dependent resource will also fail. However, the configuration file
will continue to run, accomplishing as many tasks as possible, even if some of the
assertions or resource dependencies fail, bringing your machine as far along in the set
up process as possible before completing. Once the configuration has completed, it is
your responsibility to check for any failures.
For example, after running the WinGet Configuration file, you may see a result like:
PowerShell
Assert:: OsVersion
The configuration unit could not be found.
Apply :: DeveloperMode
This configuration unity was not run because an assert failed or was
false.
Apply :: WinGetPackage [vsPackage]
This configuration unity was not run because an assert failed or was
false.
In this example, the assertion checking for the required version of the Operating System
failed, so the DeveloperMode and WinGetPackage resources that included a
dependency on that assertion for the operating system version also failed. However, any
other installation and configuration tasks listed in the configuration file would continue
to move forward.
More common troubleshooting issues will be added soon. In the meantime, check the
related issues filed in the WinGet CLI repo on GitHub .
How to author a WinGet Configuration
file
Article • 09/28/2023
1. Create a YAML file following the WinGet Configuration file naming convention.
2. Familiarize yourself with the format of a WinGet Configuration file and link the
current file schema .
3. Determine the list of Assertions (required preconditions) and Resources (the list of
required installations and setting configurations to get the machine's development
environment to the desired state) to include in the file.
4. Identify the PowerShell modules and Desired State Configuration (DSC) Resources
needed to accomplish your desired configuration tasks.
5. Determine the directives and settings needed for each configuration resource.
6. Determine the dependencies for each resource.
File format
Windows Package Manager uses manifests (YAML files) to locate and install packages
for Windows users. WinGet Configuration files use the same YAML style format, adding
a JSON schema specification to help define the structure and validation of the file. To
further assist in detecting whether the format of your WinGet Configuration file is valid,
we recommend using Visual Studio Code with the YAML extension by RedHat to
support proper syntax, help detect any formatting errors, provide hover support and
auto-completion (when linked to the JSON schema file), and ensure valid formatting.
Assertions section
The list of assertions cover the preconditions (or prerequisites) required for the
resources listed in this WinGet Configuration file to succeed on the machine running the
file. Assertions can be completed in parallel and do not require any sequential order.
An example assertion:
If an assertion returns “false” to indicate the system is not in the desired state, any
Resource identifying that assertion as a dependency using the dependsOn field will be
skipped and fail to run. In this case, even though no configuration changes were applied
to the Windows environment, this configuration would be considered a successful
outcome.
Resources section
The list of Resources covers all of the software, tools, packages, etc. that need to be
installed and the configurations settings for your Windows operating system or installed
applications. Each resource will need to be given a name, description of the directive to
be carried out and the PowerShell module that will be responsible for carrying out that
directive, as well as any associated settings or dependencies.
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
assertions:
- resource: Microsoft.Windows.Developer/OsVersion
directives:
description: Verify min OS version requirement
allowPrerelease: true
settings:
MinVersion: '10.0.22000'
resources:
- resource: Microsoft.Windows.Developer/DeveloperMode
directives:
description: Enable Developer Mode
allowPrerelease: true
settings:
Ensure: Present
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: vsPackage
directives:
description: Install Visual Studio 2022 Community
allowPrerelease: true
settings:
id: Microsoft.VisualStudio.2022.Community
source: winget
- resource: Microsoft.VisualStudio.DSC/VSComponents
dependsOn:
- vsPackage
directives:
description: Install required VS workloads from vsconfig file
allowPrerelease: true
settings:
productId: Microsoft.VisualStudio.Product.Community
channelId: VisualStudio.17.Release
vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
includeRecommended: true
configurationVersion: 0.2.0
1. Schema: The first line in your configuration file should contain the following
comment: # yaml-language-server: $schema=https://aka.ms/configuration-dsc-
schema/<most recent schema version #> to establish the DSC schema being
followed by the file. To find the most recent version of the WinGet Configuration
schema, go to https://aka.ms/configuration-dsc-schema/ . The most recent
schema number at the time of this example is 0.2 , so the schema was entered as:
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2 .
2. Properties: The root node for a configuration file is properties which must contain
a configuration version ( configurationVersion: 0.2.0 in this example). This version
should be updated in accordance with updates to the configuration file. The
properties node should contain an assertions node and a resources node.
3. Assertions: List the preconditions (or prerequisites) required for this configuration
in this section.
4. Resources: Both the assertions and resources list sections consist of individual
resource nodes to represent the set up task. The resource should be given the
name of the PowerShell module followed by the name of the module's DSC
resource that will be invoked to apply your desired state:
{ModuleName}/{DscResource} . Each resource must include directives and
settings . Optionally, it can also include an id value. When applying a
configuration, WinGet will know to install the module from the PowerShell
Gallery and invoke the specified DSC resource.
5. Directives: The directives section provides information about the module and the
resource. This section should include a description value to describe the
configuration task being accomplished by the module. The allowPrerelease value
enables you to choose whether or not the configuration will be allowed ( true ) to
use "Prerelease" modules from the PowerShell Gallery .
8. ID: A unique identifier for the particular resource instance. The id value can be
used if another resource has a dependency on this resource being applied first.
We recommend including a README.md file with any Open Source published WinGet
Configuration file that includes the organizational approach of the file structure.
You can also find PowerShell DSC Resource modules in the PowerShell Gallery . This
gallery hosts hundreds of PowerShell Modules containing Desired State Configuration
(DSC) resources submitted by the user community. You can filter search results by
applying the “DSC Resource” filter under “Categories”. This repository is not verified by
Microsoft and contains resources from a variety of authors and publishers. PowerShell
modules should always be reviewed for security and credibility before being used as any
arbitrary scripting can be included. See How to check the trustworthiness of a WinGet
Configuration file for more tips on creating a trustworthy WinGet Configuration file.
How to check the trustworthiness of a
WinGet Configuration file
Article • 09/28/2023
Due to the unattended setup benefit that WinGet Configuration files enables, the
number of explicit installation notifications and approvals is significantly reduced.
Instead, using a WinGet Configuration file requires a diligent security check of the file
upfront, prior to running the configuration with the winget configure command. You
are responsible for reviewing each package that will be installed and each PowerShell
Desired State Configuration (DSC) module that will be utilized to ensure that it's coming
from a reliable source.
Be aware that:
Users who run a configuration via winget configure in an administrative shell will
not be prompted for changes to the system made in administrative context.
Users who run a configuration via winget configure in user context may only
receive a single User Account Control (UAC) prompt for elevation for the entire
configuration.
PowerShell DSC Resources can be configured to run any arbitrary code, including
but not limited to pulling down and executing additional DSC Resources and
binaries to the local machine. This requires a diligent integrity check of the
resource and credibility of the publisher. For example, the DSC Script Resource
provides a mechanism to run Windows PowerShell script blocks on target nodes
(using Get, Set, and Test scripts). Do not run script resources from untrusted
publishers without reviewing the scripts contents.
This section provides guidance about submission process for contributing packages to
Windows Package Manager (packages that can be installed with winget).
Ensure your submission adheres to the Windows Package Manager repository policies.
Community member
If you are a GitHub community member, you may also submit packages to Windows
Package Manager following the steps above.
Optionally, you may also request help to have a package added to the community
repository . To do so, create a new Package Request/Submission issue.
Related topics
Use the winget tool
Create your package manifest
Submit your manifest to the repository
Create your package manifest
Article • 11/01/2023
If you want to submit a software package to the Windows Package Manager Community
Repository, start by creating a package manifest. The manifest is a YAML file that
describes the application to be installed.
You may either use the Windows Package Manager Manifest Creator , the YAMLCreate
PowerShell script, or you can craft a manifest manually following the instructions below.
7 Note
See the Manifest FAQ below for more general high-level information explaining
manifests, packages, and versions.
PowerShell
After installation, you can run wingetcreate new to create a new package and fill in the
prompts. The last option in the WinGetCreate prompts is to submit the manifest to the
packages repository. If you choose yes, you will automatically submit your Pull Request
(PR) to the Windows Package Manager Community Repository .
7 Note
Manifests for Windows Package Manager currently do not support all YAML
features. Unsupported YAML features include anchors, complex keys, and sets.
Conventions
These conventions are used in this article:
Manifest contents
A package manifest consists of required items and optional items that can help improve
the customer experience of installing your software. This section provides a brief
summary of the required manifest schema and complete manifest schemas with
examples of each.
Each field in the manifest file must be Pascal-cased and cannot be duplicated.
For a complete list and descriptions of items in a manifest, see the manifest
specification in the Windows Package Manager Community Repository .
The partitioning scheme was added to help with GitHub's UX. Folders with thousands of
children do not render well in the browser.
YAML
The example below shows many optional metadata fields and multiple locales. Note the
default locale has more requirements than additional locales. In the show command, any
required fields that aren't provided for additional locales will display fields from the
default locale.
YAML
PackageIdentifier: "Microsoft.WindowsTerminal"
PackageVersion: "1.6.10571.0"
DefaultLocale: "en-US"
ManifestType: "version"
ManifestVersion: "1.6.0"
7 Note
If your installer is an .exe and it was built using Nullsoft or Inno, you may specify
those values instead. When Nullsoft or Inno are specified, the client will
automatically set the silent and silent with progress install behaviors for the
installer.
Installer switches
You can often figure out what silent Switches are available for an installer by passing in
a -? to the installer from the command line. Here are some common silent Switches
that can be used for different installer types.
ノ Expand table
Manifest FAQ
What is a manifest?
Manifests are YAML files containing metadata used by the Windows Package Manager
to install and upgrade software on the Windows operating system. There are thousands
of these files partitioned under the manifests directory in the winget-pkgs repository on
GitHub . The Windows Package Manager directory structure had to be partitioned so
you don't have to scroll as much in the site when looking for a manifest.
What is a package?
Think of a package as an application or a software program. Windows Package Manager
uses a "PackageIdentifier" to represent a unique package. These are generally in the
form of Publisher.Package . Sometimes you might see additional values separated by a
second period.
What is a version?
Package versions are associated with a specific release. In some cases you will see a
perfectly formed semantic version numbers and in other cases you might see something
different. These may be date driven or they might have other characters with some
package-specific meaning. The YAML key for a package version is "PackageVersion".
For more information on understanding the directory structure and creating your first
manifest, see Authoring Manifests in the winget-pkgs repo on GitHub.
After you create a package manifest that describes your application, you're ready to
submit your manifest to the Windows Package Manager repository. This is a public-
facing repository that contains a collection of manifests that the winget tool can access.
To submit your manifest, you'll upload it to the open source
https://github.com/microsoft/winget-pkgs repository on GitHub.
After you submit a pull request to add a new manifest to the GitHub repository, an
automated process will validate your manifest file and check to make sure the package
complies with the Windows Package Manager polices and is not known to be malicious.
If this validation is successful, your package will be added to the public-facing Windows
Package Manager repository so it can be discovered by the winget client tool. Note the
distinction between the manifests in the open source GitHub repository and the public-
facing Windows Package Manager repository.
) Important
Manifest validation
When you submit a manifest to the https://github.com/microsoft/winget-pkgs
repository on GitHub, your manifest will be automatically validated and evaluated for
the safety of the Windows ecosystem. Manifests may also be reviewed manually.
For more information about the validation process, see the validation process section
below.
If your validation fails, use the errors to locate the line number and make a correction.
After your manifest is validated, you can submit it to the repository.
PowerShell
powershell .\Tools\SandboxTest.ps1
manifests\m\Microsoft\VisualStudioCode\1.56.0
You may need to update this script with the correct path to your manifest file:
.\Tools\SandboxTest.ps1 <path to manifest or manifest folder>
Fork.
PowerShell
The manifests folder is the root folder for all manifests in the repository.
The letter folder is the first letter of the publisher name in the lower case. For
example, m of the publisher Microsoft.
The publisher folder is the name of the company that publishes the software. For
example, Microsoft.
The application folder is the name of the application or tool. For example, VSCode.
The version folder is the version of the application or tool. For example, 1.0.0.
The PackageIdentifier and the PackageVersion values in the manifest must match the
publisher, application names and version in the manifest folder path. For more
information, see Create your package manifest.
1. Use the commit command to add files and commit the change and provide
information on the submission.
PowerShell
2. Use the push command to push the changes to the remote repository.
PowerShell
git push
Submission process
When you create a pull request, this will start an automated process that validates the
manifests and verifies your pull request. During this process we will run tests against the
installer and installed binaries to validate the submission.
We add labels to your pull request so you can track its progress. For more information
on labels and the process see the pull request labels section below.
Once complete, your submission will be manually reviewed by a moderator, and after it
is approved, your application will be added to the Windows Package Manager catalog.
If there is ever an error during the process, you will be notified and our labels and bot
will assist you in fixing your submission. For the list of common errors, see the validation
process section below.
Validation process
When you create a pull request to submit your manifest to the Windows Package
Manager repository, this will start an automation process that validates the manifest and
processes your pull request. GitHub labels are used to share progress and allow you to
communicate with us.
Submission expectations
All application submissions to the Windows Package Manager repository should adhere
to the Windows Package Manager repository policies.
For a complete list of the policies, see Windows Package Manager policies.
Status labels
The following table describes the status labels you might encounter.
Label Details
Azure- The manifest has completed the test pass. It is waiting for approval. If no issues are
Pipeline- encountered during the test pass it will automatically be approved. If a test fails, it
Passed may be flagged for manual review.
Blocking- This label indicates that the pull request cannot be approved because there is a
Issue blocking issue. You can often tell what the blocking issue is by the included error
label.
Needs- This label indicates that the pull request needs to be investigated by the Windows
Attention Package Manager development team. This is either due to a test failure that needs
manual review, or a comment added to the pull request by the community.
Needs- Indicates there is a failure with the submission. We will reassign the pull request
Author- back to you. If you do not address the issue within 10 days, the bot will close the
Feedback pull request. Needs-Author-Feedback labels are typically added when there was a
failure with the pull request that should be updated, or if the person reviewing the
pull request has a question.
Validation- Indicates that the test pass has been completed successfully and your pull request
Completed will be merged.
Error labels
The following table describes the error labels you might encounter. Not all of the error
cases will be assigned to you immediately. Some may trigger manual validation.
Label Details
Binary- The application included in this pull request failed to pass the Installers Scan test.
Validation- This test is designed to ensure that the application installs on all environments
Error without warnings. For more details on this error, see the Binary validation error
section below.
Error- The Binary-Validation-Test test timed out. The pull request will get assigned to a
Analysis- Windows Package Manager engineer to investigate.
Timeout
Error-Hash- The submitted manifest could not be processed because the InstallerSha256
Mismatch hash provided for the InstallerURL did not match. Update the InstallerSha256 in
the pull request and try again.
Error- The validation service was unable to download the installer. This may be related
Installer- to Azure IP ranges being blocked, or the installer URL may be incorrect. Check
Availability that the InstallerURL is correct and try again. If you feel this has failed in error,
add a comment and the pull request will get assigned to a Windows Package
Manager engineer to investigate.
Manifest- There are either inconsistencies or values not present in the manifest during the
Installer- evaluation of an MSIX package.
Validation-
Error
Manifest- The manifest files must be put into a specific folder structure. This label indicates
Path-Error a problem with the path of your submission. For example, the folder structure
does not have the required format. Update your manifest and path resubmit your
pull request.
Manifest- The submitted manifest contains a syntax error. Address the syntax issue with the
Validation- manifest and re-submit. For details on the manifest format and schema, see
Error required format.
PullRequest- The pull request is invalid because not all files submitted are under manifest
Error folder or there is more than one package or version in the pull request. Update
your pull request to address the issue and try again.
URL- The URLs Validation Test could not locate the URL and responded with a HTTP
Validation- error status code (403 or 404), or the URL reputation test failed. You can identify
Error which URL is in question by looking at the pull request check details. To address
this issue, update the URLs in question to resolve the HTTP error status code. If
the issue is not due to an HTTP error status code, you can submit the URL for
review to avoid the reputation failure.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Domain domain expected. The Windows Package Manager policies requires that the
InstallerUrl comes directly from the ISV's release location. If you believe this is a
false detection, add a comment to the pull request to get the Windows Package
Manager engineers to investigate.
Validation- Validation of the Windows Package Manager failed during manual approval. Look
Error at the accompanying comment for next steps.
Validation- During installation testing, the test was unable to locate the primary application.
Executable- Make sure the application installs correctly on all platforms. If your application
Error does not install an application, but should still be included in the repository, add
a comment to the pull request to get the Windows Package Manager engineers
to investigate.
Validation- During installation testing, the application fails to install because the
Hash- InstallerSha256 no longer matches the InstallerURL hash. This can occur if the
Verification- application is behind a vanity URL and the installer was updated without updating
Failed the InstallerSha256. To address this issue, update the InstallerSha256 associated
with the InstallerURL and submit again.
Validation- The URL used for the installer does not use the HTTPS protocol. Update the
HTTP-Error InstallerURL to use HTTPS and resubmit the Pull Request.
Validation- The URL is not coming directly from the ISVs server. Testing has determined a
Indirect-URL redirector has been used. This is not allowed because the Windows Package
Manager policies require that the InstallerUrl comes directly from the ISV's
release location. Remove the redirection and resubmit.
Validation- During manual validation of this package, there was a general error. Look at the
Installation- accompanying comment for next steps.
Error
Validation- This package could not be validated due to a merge conflict. Please address the
Merge- merge conflict and resubmit your pull request.
Conflict
Validation- The MSIX package has a dependency on package that could not be resolved.
MSIX- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Unapproved- domain expected. The Windows Package Manager policies requires that the
URL InstallerUrl comes directly from the ISV's release location.
Validation- During installation, the test timed out. This most likely is due to the application
Unattended- not installing silently. It could also be due to some other error being encountered
Failed and stopping the test. Verify that you can install your manifest without user input.
If you need assistance, add a comment to the pull request and the Windows
Package Manager engineers will investigate.
Validation- During uninstall testing, the application did not clean up completely following
Uninstall- uninstall. Look at the accompanying comment for more details.
Error
Validation- The package has a dependency on the C++ runtime that could not be resolved.
VCRuntime- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
The following table lists content policy labels. If one of these labels is added, something
in the manifest metadata triggered additional manual content review to ensure that the
metadata is following the Windows Package Manager policies.
Label Details
Policy-Test-2.2 See Content Including Names, Logos, Original and Third Party
Internal labels
The following table lists internal error labels. When internal errors are encountered, your
pull request will be assigned to the Windows Package Manager engineers to investigate.
Label Details
Internal-Error- An error occurred because the test could not determine the
NoArchitectures architecture if the application.
Each submission to the Windows Package Manager Repository is run through several
antivirus programs. These programs all have different virus detection algorithms for
identifying potentially unwanted applications (PUA) and malware.
In some cases, the antivirus vendor can't determine whether the detected code anomaly
is a false positive. In this case, the application can't be added to the Windows Package
Manager repository. The pull request is rejected with a Binary-Validation-Error label.
If you get a Binary-Validation-Error label on your pull request, update your software to
remove the code detected as PUA.
Sometimes, genuine tools used for debugging and low-level activities appear as PUA to
antivirus software. This is because the necessary debugging code has a similar signature
to unwanted software. Even though this coding practice is legitimate, the Windows
Package Manager repository unfortunately can't allow these applications.
Submission Troubleshooting
If your Windows Package Manager submission fails, you can use the labels described
above to investigate the reason for the failure.
1. A pull request failure appears at the bottom of the web page with the string Some
checks were not successful. Select the Details link next to a failed validation to go
to the Azure Pipelines page.
2. On the Azure Pipelines page, select the 0 errors / 0 warnings link.
4. The next page shows the output for the failed job. The output should help you
identify the change you need to make to fix the manifest.
In the following example, the failure was during the Installation Validation task.
Submit your manifest to the repository
Article • 03/01/2023
After you create a package manifest that describes your application, you're ready to
submit your manifest to the Windows Package Manager repository. This is a public-
facing repository that contains a collection of manifests that the winget tool can access.
To submit your manifest, you'll upload it to the open source
https://github.com/microsoft/winget-pkgs repository on GitHub.
After you submit a pull request to add a new manifest to the GitHub repository, an
automated process will validate your manifest file and check to make sure the package
complies with the Windows Package Manager polices and is not known to be malicious.
If this validation is successful, your package will be added to the public-facing Windows
Package Manager repository so it can be discovered by the winget client tool. Note the
distinction between the manifests in the open source GitHub repository and the public-
facing Windows Package Manager repository.
) Important
Manifest validation
When you submit a manifest to the https://github.com/microsoft/winget-pkgs
repository on GitHub, your manifest will be automatically validated and evaluated for
the safety of the Windows ecosystem. Manifests may also be reviewed manually.
For more information about the validation process, see the validation process section
below.
If your validation fails, use the errors to locate the line number and make a correction.
After your manifest is validated, you can submit it to the repository.
PowerShell
powershell .\Tools\SandboxTest.ps1
manifests\m\Microsoft\VisualStudioCode\1.56.0
You may need to update this script with the correct path to your manifest file:
.\Tools\SandboxTest.ps1 <path to manifest or manifest folder>
Fork.
PowerShell
The manifests folder is the root folder for all manifests in the repository.
The letter folder is the first letter of the publisher name in the lower case. For
example, m of the publisher Microsoft.
The publisher folder is the name of the company that publishes the software. For
example, Microsoft.
The application folder is the name of the application or tool. For example, VSCode.
The version folder is the version of the application or tool. For example, 1.0.0.
The PackageIdentifier and the PackageVersion values in the manifest must match the
publisher, application names and version in the manifest folder path. For more
information, see Create your package manifest.
1. Use the commit command to add files and commit the change and provide
information on the submission.
PowerShell
2. Use the push command to push the changes to the remote repository.
PowerShell
git push
Submission process
When you create a pull request, this will start an automated process that validates the
manifests and verifies your pull request. During this process we will run tests against the
installer and installed binaries to validate the submission.
We add labels to your pull request so you can track its progress. For more information
on labels and the process see the pull request labels section below.
Once complete, your submission will be manually reviewed by a moderator, and after it
is approved, your application will be added to the Windows Package Manager catalog.
If there is ever an error during the process, you will be notified and our labels and bot
will assist you in fixing your submission. For the list of common errors, see the validation
process section below.
Validation process
When you create a pull request to submit your manifest to the Windows Package
Manager repository, this will start an automation process that validates the manifest and
processes your pull request. GitHub labels are used to share progress and allow you to
communicate with us.
Submission expectations
All application submissions to the Windows Package Manager repository should adhere
to the Windows Package Manager repository policies.
For a complete list of the policies, see Windows Package Manager policies.
Status labels
The following table describes the status labels you might encounter.
Label Details
Azure- The manifest has completed the test pass. It is waiting for approval. If no issues are
Pipeline- encountered during the test pass it will automatically be approved. If a test fails, it
Passed may be flagged for manual review.
Blocking- This label indicates that the pull request cannot be approved because there is a
Issue blocking issue. You can often tell what the blocking issue is by the included error
label.
Needs- This label indicates that the pull request needs to be investigated by the Windows
Attention Package Manager development team. This is either due to a test failure that needs
manual review, or a comment added to the pull request by the community.
Needs- Indicates there is a failure with the submission. We will reassign the pull request
Author- back to you. If you do not address the issue within 10 days, the bot will close the
Feedback pull request. Needs-Author-Feedback labels are typically added when there was a
failure with the pull request that should be updated, or if the person reviewing the
pull request has a question.
Validation- Indicates that the test pass has been completed successfully and your pull request
Completed will be merged.
Error labels
The following table describes the error labels you might encounter. Not all of the error
cases will be assigned to you immediately. Some may trigger manual validation.
Label Details
Binary- The application included in this pull request failed to pass the Installers Scan test.
Validation- This test is designed to ensure that the application installs on all environments
Error without warnings. For more details on this error, see the Binary validation error
section below.
Error- The Binary-Validation-Test test timed out. The pull request will get assigned to a
Analysis- Windows Package Manager engineer to investigate.
Timeout
Error-Hash- The submitted manifest could not be processed because the InstallerSha256
Mismatch hash provided for the InstallerURL did not match. Update the InstallerSha256 in
the pull request and try again.
Error- The validation service was unable to download the installer. This may be related
Installer- to Azure IP ranges being blocked, or the installer URL may be incorrect. Check
Availability that the InstallerURL is correct and try again. If you feel this has failed in error,
add a comment and the pull request will get assigned to a Windows Package
Manager engineer to investigate.
Manifest- There are either inconsistencies or values not present in the manifest during the
Installer- evaluation of an MSIX package.
Validation-
Error
Manifest- The manifest files must be put into a specific folder structure. This label indicates
Path-Error a problem with the path of your submission. For example, the folder structure
does not have the required format. Update your manifest and path resubmit your
pull request.
Manifest- The submitted manifest contains a syntax error. Address the syntax issue with the
Validation- manifest and re-submit. For details on the manifest format and schema, see
Error required format.
PullRequest- The pull request is invalid because not all files submitted are under manifest
Error folder or there is more than one package or version in the pull request. Update
your pull request to address the issue and try again.
URL- The URLs Validation Test could not locate the URL and responded with a HTTP
Validation- error status code (403 or 404), or the URL reputation test failed. You can identify
Error which URL is in question by looking at the pull request check details. To address
this issue, update the URLs in question to resolve the HTTP error status code. If
the issue is not due to an HTTP error status code, you can submit the URL for
review to avoid the reputation failure.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Domain domain expected. The Windows Package Manager policies requires that the
InstallerUrl comes directly from the ISV's release location. If you believe this is a
false detection, add a comment to the pull request to get the Windows Package
Manager engineers to investigate.
Validation- Validation of the Windows Package Manager failed during manual approval. Look
Error at the accompanying comment for next steps.
Validation- During installation testing, the test was unable to locate the primary application.
Executable- Make sure the application installs correctly on all platforms. If your application
Error does not install an application, but should still be included in the repository, add
a comment to the pull request to get the Windows Package Manager engineers
to investigate.
Validation- During installation testing, the application fails to install because the
Hash- InstallerSha256 no longer matches the InstallerURL hash. This can occur if the
Verification- application is behind a vanity URL and the installer was updated without updating
Failed the InstallerSha256. To address this issue, update the InstallerSha256 associated
with the InstallerURL and submit again.
Validation- The URL used for the installer does not use the HTTPS protocol. Update the
HTTP-Error InstallerURL to use HTTPS and resubmit the Pull Request.
Validation- The URL is not coming directly from the ISVs server. Testing has determined a
Indirect-URL redirector has been used. This is not allowed because the Windows Package
Manager policies require that the InstallerUrl comes directly from the ISV's
release location. Remove the redirection and resubmit.
Validation- During manual validation of this package, there was a general error. Look at the
Installation- accompanying comment for next steps.
Error
Validation- This package could not be validated due to a merge conflict. Please address the
Merge- merge conflict and resubmit your pull request.
Conflict
Validation- The MSIX package has a dependency on package that could not be resolved.
MSIX- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Unapproved- domain expected. The Windows Package Manager policies requires that the
URL InstallerUrl comes directly from the ISV's release location.
Validation- During installation, the test timed out. This most likely is due to the application
Unattended- not installing silently. It could also be due to some other error being encountered
Failed and stopping the test. Verify that you can install your manifest without user input.
If you need assistance, add a comment to the pull request and the Windows
Package Manager engineers will investigate.
Validation- During uninstall testing, the application did not clean up completely following
Uninstall- uninstall. Look at the accompanying comment for more details.
Error
Validation- The package has a dependency on the C++ runtime that could not be resolved.
VCRuntime- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
The following table lists content policy labels. If one of these labels is added, something
in the manifest metadata triggered additional manual content review to ensure that the
metadata is following the Windows Package Manager policies.
Label Details
Policy-Test-2.2 See Content Including Names, Logos, Original and Third Party
Internal labels
The following table lists internal error labels. When internal errors are encountered, your
pull request will be assigned to the Windows Package Manager engineers to investigate.
Label Details
Internal-Error- An error occurred because the test could not determine the
NoArchitectures architecture if the application.
Each submission to the Windows Package Manager Repository is run through several
antivirus programs. These programs all have different virus detection algorithms for
identifying potentially unwanted applications (PUA) and malware.
In some cases, the antivirus vendor can't determine whether the detected code anomaly
is a false positive. In this case, the application can't be added to the Windows Package
Manager repository. The pull request is rejected with a Binary-Validation-Error label.
If you get a Binary-Validation-Error label on your pull request, update your software to
remove the code detected as PUA.
Sometimes, genuine tools used for debugging and low-level activities appear as PUA to
antivirus software. This is because the necessary debugging code has a similar signature
to unwanted software. Even though this coding practice is legitimate, the Windows
Package Manager repository unfortunately can't allow these applications.
Submission Troubleshooting
If your Windows Package Manager submission fails, you can use the labels described
above to investigate the reason for the failure.
1. A pull request failure appears at the bottom of the web page with the string Some
checks were not successful. Select the Details link next to a failed validation to go
to the Azure Pipelines page.
2. On the Azure Pipelines page, select the 0 errors / 0 warnings link.
4. The next page shows the output for the failed job. The output should help you
identify the change you need to make to fix the manifest.
In the following example, the failure was during the Installation Validation task.
Submit your manifest to the repository
Article • 03/01/2023
After you create a package manifest that describes your application, you're ready to
submit your manifest to the Windows Package Manager repository. This is a public-
facing repository that contains a collection of manifests that the winget tool can access.
To submit your manifest, you'll upload it to the open source
https://github.com/microsoft/winget-pkgs repository on GitHub.
After you submit a pull request to add a new manifest to the GitHub repository, an
automated process will validate your manifest file and check to make sure the package
complies with the Windows Package Manager polices and is not known to be malicious.
If this validation is successful, your package will be added to the public-facing Windows
Package Manager repository so it can be discovered by the winget client tool. Note the
distinction between the manifests in the open source GitHub repository and the public-
facing Windows Package Manager repository.
) Important
Manifest validation
When you submit a manifest to the https://github.com/microsoft/winget-pkgs
repository on GitHub, your manifest will be automatically validated and evaluated for
the safety of the Windows ecosystem. Manifests may also be reviewed manually.
For more information about the validation process, see the validation process section
below.
If your validation fails, use the errors to locate the line number and make a correction.
After your manifest is validated, you can submit it to the repository.
PowerShell
powershell .\Tools\SandboxTest.ps1
manifests\m\Microsoft\VisualStudioCode\1.56.0
You may need to update this script with the correct path to your manifest file:
.\Tools\SandboxTest.ps1 <path to manifest or manifest folder>
Fork.
PowerShell
The manifests folder is the root folder for all manifests in the repository.
The letter folder is the first letter of the publisher name in the lower case. For
example, m of the publisher Microsoft.
The publisher folder is the name of the company that publishes the software. For
example, Microsoft.
The application folder is the name of the application or tool. For example, VSCode.
The version folder is the version of the application or tool. For example, 1.0.0.
The PackageIdentifier and the PackageVersion values in the manifest must match the
publisher, application names and version in the manifest folder path. For more
information, see Create your package manifest.
1. Use the commit command to add files and commit the change and provide
information on the submission.
PowerShell
2. Use the push command to push the changes to the remote repository.
PowerShell
git push
Submission process
When you create a pull request, this will start an automated process that validates the
manifests and verifies your pull request. During this process we will run tests against the
installer and installed binaries to validate the submission.
We add labels to your pull request so you can track its progress. For more information
on labels and the process see the pull request labels section below.
Once complete, your submission will be manually reviewed by a moderator, and after it
is approved, your application will be added to the Windows Package Manager catalog.
If there is ever an error during the process, you will be notified and our labels and bot
will assist you in fixing your submission. For the list of common errors, see the validation
process section below.
Validation process
When you create a pull request to submit your manifest to the Windows Package
Manager repository, this will start an automation process that validates the manifest and
processes your pull request. GitHub labels are used to share progress and allow you to
communicate with us.
Submission expectations
All application submissions to the Windows Package Manager repository should adhere
to the Windows Package Manager repository policies.
For a complete list of the policies, see Windows Package Manager policies.
Status labels
The following table describes the status labels you might encounter.
Label Details
Azure- The manifest has completed the test pass. It is waiting for approval. If no issues are
Pipeline- encountered during the test pass it will automatically be approved. If a test fails, it
Passed may be flagged for manual review.
Blocking- This label indicates that the pull request cannot be approved because there is a
Issue blocking issue. You can often tell what the blocking issue is by the included error
label.
Needs- This label indicates that the pull request needs to be investigated by the Windows
Attention Package Manager development team. This is either due to a test failure that needs
manual review, or a comment added to the pull request by the community.
Needs- Indicates there is a failure with the submission. We will reassign the pull request
Author- back to you. If you do not address the issue within 10 days, the bot will close the
Feedback pull request. Needs-Author-Feedback labels are typically added when there was a
failure with the pull request that should be updated, or if the person reviewing the
pull request has a question.
Validation- Indicates that the test pass has been completed successfully and your pull request
Completed will be merged.
Error labels
The following table describes the error labels you might encounter. Not all of the error
cases will be assigned to you immediately. Some may trigger manual validation.
Label Details
Binary- The application included in this pull request failed to pass the Installers Scan test.
Validation- This test is designed to ensure that the application installs on all environments
Error without warnings. For more details on this error, see the Binary validation error
section below.
Error- The Binary-Validation-Test test timed out. The pull request will get assigned to a
Analysis- Windows Package Manager engineer to investigate.
Timeout
Error-Hash- The submitted manifest could not be processed because the InstallerSha256
Mismatch hash provided for the InstallerURL did not match. Update the InstallerSha256 in
the pull request and try again.
Error- The validation service was unable to download the installer. This may be related
Installer- to Azure IP ranges being blocked, or the installer URL may be incorrect. Check
Availability that the InstallerURL is correct and try again. If you feel this has failed in error,
add a comment and the pull request will get assigned to a Windows Package
Manager engineer to investigate.
Manifest- There are either inconsistencies or values not present in the manifest during the
Installer- evaluation of an MSIX package.
Validation-
Error
Manifest- The manifest files must be put into a specific folder structure. This label indicates
Path-Error a problem with the path of your submission. For example, the folder structure
does not have the required format. Update your manifest and path resubmit your
pull request.
Manifest- The submitted manifest contains a syntax error. Address the syntax issue with the
Validation- manifest and re-submit. For details on the manifest format and schema, see
Error required format.
PullRequest- The pull request is invalid because not all files submitted are under manifest
Error folder or there is more than one package or version in the pull request. Update
your pull request to address the issue and try again.
URL- The URLs Validation Test could not locate the URL and responded with a HTTP
Validation- error status code (403 or 404), or the URL reputation test failed. You can identify
Error which URL is in question by looking at the pull request check details. To address
this issue, update the URLs in question to resolve the HTTP error status code. If
the issue is not due to an HTTP error status code, you can submit the URL for
review to avoid the reputation failure.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Domain domain expected. The Windows Package Manager policies requires that the
InstallerUrl comes directly from the ISV's release location. If you believe this is a
false detection, add a comment to the pull request to get the Windows Package
Manager engineers to investigate.
Validation- Validation of the Windows Package Manager failed during manual approval. Look
Error at the accompanying comment for next steps.
Validation- During installation testing, the test was unable to locate the primary application.
Executable- Make sure the application installs correctly on all platforms. If your application
Error does not install an application, but should still be included in the repository, add
a comment to the pull request to get the Windows Package Manager engineers
to investigate.
Validation- During installation testing, the application fails to install because the
Hash- InstallerSha256 no longer matches the InstallerURL hash. This can occur if the
Verification- application is behind a vanity URL and the installer was updated without updating
Failed the InstallerSha256. To address this issue, update the InstallerSha256 associated
with the InstallerURL and submit again.
Validation- The URL used for the installer does not use the HTTPS protocol. Update the
HTTP-Error InstallerURL to use HTTPS and resubmit the Pull Request.
Validation- The URL is not coming directly from the ISVs server. Testing has determined a
Indirect-URL redirector has been used. This is not allowed because the Windows Package
Manager policies require that the InstallerUrl comes directly from the ISV's
release location. Remove the redirection and resubmit.
Validation- During manual validation of this package, there was a general error. Look at the
Installation- accompanying comment for next steps.
Error
Validation- This package could not be validated due to a merge conflict. Please address the
Merge- merge conflict and resubmit your pull request.
Conflict
Validation- The MSIX package has a dependency on package that could not be resolved.
MSIX- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
Label Details
Validation- The test has determined the domain if the InstallerURL does not match the
Unapproved- domain expected. The Windows Package Manager policies requires that the
URL InstallerUrl comes directly from the ISV's release location.
Validation- During installation, the test timed out. This most likely is due to the application
Unattended- not installing silently. It could also be due to some other error being encountered
Failed and stopping the test. Verify that you can install your manifest without user input.
If you need assistance, add a comment to the pull request and the Windows
Package Manager engineers will investigate.
Validation- During uninstall testing, the application did not clean up completely following
Uninstall- uninstall. Look at the accompanying comment for more details.
Error
Validation- The package has a dependency on the C++ runtime that could not be resolved.
VCRuntime- Update the package to include the missing components or add the dependency
Dependency to the manifest file and resubmit the pull request.
The following table lists content policy labels. If one of these labels is added, something
in the manifest metadata triggered additional manual content review to ensure that the
metadata is following the Windows Package Manager policies.
Label Details
Policy-Test-2.2 See Content Including Names, Logos, Original and Third Party
Internal labels
The following table lists internal error labels. When internal errors are encountered, your
pull request will be assigned to the Windows Package Manager engineers to investigate.
Label Details
Internal-Error- An error occurred because the test could not determine the
NoArchitectures architecture if the application.
Each submission to the Windows Package Manager Repository is run through several
antivirus programs. These programs all have different virus detection algorithms for
identifying potentially unwanted applications (PUA) and malware.
In some cases, the antivirus vendor can't determine whether the detected code anomaly
is a false positive. In this case, the application can't be added to the Windows Package
Manager repository. The pull request is rejected with a Binary-Validation-Error label.
If you get a Binary-Validation-Error label on your pull request, update your software to
remove the code detected as PUA.
Sometimes, genuine tools used for debugging and low-level activities appear as PUA to
antivirus software. This is because the necessary debugging code has a similar signature
to unwanted software. Even though this coding practice is legitimate, the Windows
Package Manager repository unfortunately can't allow these applications.
Submission Troubleshooting
If your Windows Package Manager submission fails, you can use the labels described
above to investigate the reason for the failure.
1. A pull request failure appears at the bottom of the web page with the string Some
checks were not successful. Select the Details link next to a failed validation to go
to the Azure Pipelines page.
2. On the Azure Pipelines page, select the 0 errors / 0 warnings link.
4. The next page shows the output for the failed job. The output should help you
identify the change you need to make to fix the manifest.
In the following example, the failure was during the Installation Validation task.
Windows Package Manager repository
policies
Article • 05/05/2023
Thank you for your interest in providing a Product to the Windows Package Manager
repository.
Product refers to content in whatever form including, but not limited to, apps,
games, titles, and any additional content sold or offered from within a Product.
Submission refers to a pull request of manifest files and includes but is not
limited to the Product and metadata about the Product.
Offer unique and distinct value within your Submission. Provide a compelling
reason to download the Product from the Windows Package Manager
repository .
Don’t mislead our customers about what your Submission can do, who is offering
it, etc.
Don’t attempt to cheat customers, the system or the ecosystem. There is no place
in the repository for any kind of fraud, be it ratings and review manipulation, credit
card fraud or other fraudulent activity.
Adhering to these policies should help you make choices that enhance your
Submission's appeal and audience.
If you have feedback on the policies or Windows Package Manager, let us know by
commenting in our GitHub issues forum
Table of Contents
Product Policies:
1.1 Distinct Function & Value; Accurate Representation
1.2 Security
1.3 Product is Testable
1.4 Usability
1.5 Personal Information
1.6 Capabilities
1.7 Localization
1.8 Financial Transactions
1.9 Notifications
1.10 Advertising Conduct and Content
Content Policies:
Product Policies
1.1.1
All aspects of the Product should accurately describe the functions, features and any
important limitations of the Product.
1.1.2
Tags may not exceed 16 unique tags and should be relevant to the Product.
1.1.3
The Product must have distinct and informative metadata and must provide a valuable
and quality user experience.
1.1.4
The InstallerUrl must be the ISV's release location for the Product. Products from
download websites will not be allowed.
1.2 Security
The Product must not jeopardize or compromise user security, or the security or
functionality of the device, system or related systems.
1.2.1
The Product must not attempt to change or extend its described functionality through
any form of dynamic inclusion of code that is in violation of Windows Package Manager
Policies. The Product should not, for example, download a remote script and
subsequently execute that script in a manner that is not consistent with the described
functionality.
1.2.2
The Product must not contain or enable malware as defined by the Microsoft criteria for
Unwanted and Malicious Software.
1.2.3
The Product may contain fully integrated middleware (such as third-party cross-platform
engines and third-party analytics services).
The Product may depend on non-integrated software (such as another Product, module,
or service) to deliver its primary functionality.
1.4 Usability
The Product should meet usability standards, including, but not limited to, those listed
in the subsections below.
1.4.1
The Product should support the devices and platforms on which they are downloaded,
including compatibility with the software, hardware and screen resolution requirements
specified by the Product. If the Product is downloaded on a device with which it is not
compatible, it should detect that at launch and display a message to the customer
detailing the requirements.
1.4.2
The Product should continue to run and remain responsive to user input. Products
should shut down gracefully and not close unexpectedly. The Product should handle
exceptions raised by any of the managed or native system APIs and remain responsive
to user input after the exception is handled.
1.4.3
The Product should start up promptly and must stay responsive to user input.
1.5.1
If the Product accesses, collects or transmits Personal Information, or if otherwise
required by law, it should maintain a privacy policy. The submission, should include the
PrivacyUrl which links to the privacy policy of the Product.
1.5.2
If the Product publishes the Personal Information of customers of the Product to an
outside service or third party, the Product should only do so after obtaining opt-in
consent from those customers. Opt-in consent means the customer gives their express
permission in the Product user interface for the requested activity, after the Product has:
Described to the customer how the information will be accessed, used or shared,
indicating the types of parties to whom it is disclosed, and
Provided the customer a mechanism in the Product user interface through which
they can later rescind this permission and opt-out.
1.5.3
If the Product publishes a person’s Personal Information to an outside service or third
party through the Product or its metadata, but the person whose information is being
shared is not a customer of the Product, the Product must obtain express written
consent to publish that Personal Information, and must permit the person whose
information is shared to withdraw that consent at any time. If the Product provides a
customer with access to another person’s Personal Information, this requirement would
also apply.
1.5.4
If the Product collects, stores or transmits Personal Information, it must do so securely,
by using modern cryptography methods.
1.5.5
The Product must not collect, store or transmit highly sensitive personal information,
such as health or financial data, unless the information is related to the Product’s
functionality. The Product must also obtain express user consent before collecting,
storing or transmitting such information. The Product’s privacy policy must clearly tell
the user when and why it is collecting Personal Information and how it will be used.
1.5.6
If the Product supports Microsoft identity authentication it must do so only by using
Microsoft-approved methods.
1.5.7
Products that receive device location must provide settings that allow the user to enable
and disable the Product's access to and use of location from the Location Service API.
1.6 Capabilities
If the Product declares the use of capabilities, then the capabilities the Product declares
must legitimately relate to the functions of the Product. The Product must not
circumvent operating system checks for capability usage.
1.7 Localization
You should localize your Product for all languages that it supports. The text of your
product’s description should be localized in each language that you declare. If your
product is localized such that some features are not available in a localized version, you
should clearly state or display the limits of localization in the product description. The
experience provided by a product must be reasonably similar in all languages that it
supports.
1.8.1
In-product offerings sold in your product cannot be converted to any legally valid
currency (for example, USD, Euro, etc.) or any physical goods or services.
1.8.2
The Product must use a secure purchase API for purchases of physical goods or services,
and a secure purchase API for payments made in connection with real world gambling
or charitable contributions. If the Product is used to facilitate or collect charitable
contributions or to conduct a promotional sweepstakes or contest, it must do so in
compliance with applicable law. The Product must also state clearly that Microsoft is not
the fundraiser or sponsor of the promotion.
The Product must use a secure purchase API to receive voluntary donations from users.
1.8.3
The product and its associated metadata must provide information about the types of
in-product purchases offered and the range of prices. The Product not mislead
customers and must be clear about the nature of the in-product promotions and
offerings including the scope and terms of any trial experiences. If the Product restricts
access to user-created content during or after a trial, it must notify users in advance. In
addition, the Product must make it clear to users that they are initiating a purchase
option in the Product.
If your game offers “loot boxes” or other mechanisms that provide randomized virtual
items, then you must disclose the odds of receiving each item to customers prior to
purchase. These disclosures may appear: in-product, such as in an in-app store, on the
Microsoft Store Product Description Page (PDP), and/or on a developer or publisher
website, with a link from the Store Product Description Page (PDP) and/or in-app.
1.8.4
All pricing, including sales or discounting, for your digital products or services shall
comply with all applicable laws, regulations and regulatory guidelines, including without
limitation, the Federal Trade Commission Guides Against Deceptive Pricing .
1.9 Notifications
If the Product supports notifications, then the Product must respect system settings for
notifications and remain functional when they are disabled. This includes the
presentation of ads and notifications to the customer, which must also be consistent
with the customer’s preferences, whether the notifications are provided by the Microsoft
Push Notification Service (MPNS), Windows Push Notification Service (WNS) or any
other service. If the customer disables notifications, either on an Product-specific or
system-wide basis, the Product must remain functional.
1.10.1
The primary purpose of the Product should not be to get users to click ads.
The Product may not do anything that interferes with or diminishes the visibility,
value, or quality of any ads it displays.
The Product must respect advertising ID settings that the user has selected.
All advertising must be truthful, non-misleading and comply with all applicable
laws, regulations, and regulatory guidelines.
Content Policies
The following policies apply to content and metadata (including publisher name,
Product name, Product icon, Product description, Product screenshots, Product trailers
and trailer thumbnails, and any other Product metadata) offered for distribution in the
Windows Package Manager repository. Content means the Product name, publisher
name, Product icon, Product description, the images, sounds, videos and text contained
in the Product, the tiles, notifications, error messages or ads exposed through the
Product, and anything that’s delivered from a server or that the Product connects to.
Because Product and the Windows Package Manager repository are used around the
world, these requirements will be interpreted and applied in the context of regional and
cultural norms.
2.3.1
The Product must not contain any content that facilitates or glamorizes the following
real world activities: (a) extreme or gratuitous violence; (b) human rights violations; (c)
the creation of illegal weapons; or (d) the use of weapons against a person, animal, or
real or personal property.
2.3.2
The Product must not: (a) pose a safety risk to, nor result in discomfort, injury or any
other harm to end users or to any other person or animal; or (b) pose a risk of or result
in damage to real or personal property. You are solely responsible for all Product safety
testing, certificate acquisition, and implementation of any appropriate feature
safeguards. You will not disable any platform safety or comfort features, and you must
include all legally required and industry-standard warnings, notices, and disclaimers in
the Product.
China
2.11.1
If the Product provides content (such as user-generated, retail or other web-based
content) that might be appropriate for a higher age rating than its assigned rating, you
must enable users to opt in to receiving such content by using a content filter or by
signing in with a pre-existing account.
2.12 User Generated Content
User Generated Content (UGC) is content that users contribute to an app or Product and
which can be viewed or accessed by other users in an online state. If the Product
contains UGC, the Product should:
Publish and make available to users a Product terms of service and/or content
guidelines for User Generated Content either in Product or on the Product website.
Provide a means for users to report inappropriate content within the Product to
the developer for review and removal/disablement if in violation of content
guidelines and/or implement a method for proactive detection of inappropriate or
harmful UGC.
Remove or disable UGC when requested by Microsoft.
See also
Windows Package Manager Code of Conduct
Windows Package Manager Contributing requirements
Microsoft PowerToys: Utilities to
customize Windows
Article • 04/12/2024
Microsoft PowerToys is a set of utilities for power users to tune and streamline their
Windows experience for greater productivity.
Install PowerToys
Always On Top
Always On Top enables you to pin windows above other windows with a quick key
shortcut ( ⊞ Win + Ctrl + T ).
PowerToys Awake
PowerToys Awake is designed to keep a computer awake without having to manage its
power & sleep settings. This behavior can be helpful when running time-consuming
tasks, ensuring that the computer does not go to sleep or turns off its displays.
Color Picker
Color Picker is a system-wide color picking utility activated with ⊞ Win + Shift + C . Pick
colors from anywhere on the screen, the picker automatically copies the color to your
clipboard in a set format. Color Picker contains an editor that shows a history of
previously picked colors, allows you to fine-tune the selected color and to copy different
string representations. This code is based on Martin Chrzan's Color Picker.
Crop And Lock is a utility that creates a new window that's a crop or a thumbnail of
another window.
Environment Variables
Environment Variables offers an easy and convenient way to manage environment
variables. You can create profiles for managing a set of variables together.
FancyZones
FancyZones is a window manager that makes it easy to create complex window layouts
and quickly position windows into those layouts.
File Locksmith
File Locksmith is a Windows shell extension to check which files are in use and by which
processes. Right-click on one or more selected files in File Explorer and select Unlock
with File Locksmith.
Image Resizer
Image Resizer is a Windows Shell extension for quickly resizing images. With a right click
from File Explorer, instantly resize one or many images. This code is based on Brice
Lambson's Image Resizer.
Keyboard Manager
Keyboard Manager allows you to customize the keyboard to be more productive by
remapping keys and creating your own keyboard shortcuts.
Mouse utilities
Mouse utilities add functionality to enhance your mouse and cursor. With Find My
Mouse, quickly locate your mouse's position with a spotlight that focuses on your
cursor. This feature is based on source code developed by Raymond Chen. Mouse
Highlighter displays visual indicators when basic mouse buttons are clicked. Mouse
Jump allows a quick jump on large displays. Mouse Pointer Crosshairs draws crosshairs
centered on the mouse pointer.
Paste As Plain Text allows you to paste text from your clipboard, excluding text-
formatting, with a quick key shortcut ( ⊞ Win + Ctrl + Alt + V ).
Peek
Peek allows you to preview file content without the need to open multiple applications
or interrupt your workflow. Select the file and use the shortcut ( Ctrl + Space )
PowerRename
Use PowerRename to perform bulk renaming; searching and replacing file names. It
includes advanced features, such as using regular expressions, targeting specific file
types, previewing expected results, and the ability to undo changes. This code is based
on Chris Davis's SmartRename.
PowerToys Run
PowerToys Run can help you search and open your app instantly. To open, use the
shortcut Alt + Space and start typing. It is open source and modular for additional
plugins.
Quick Accent
Quick Accent is an alternative way to type accented characters, useful for when a
keyboard doesn't support that specific character with a quick key combo.
Registry Preview
Registry Preview is a utility to visualize and edit Windows Registry files.
Screen Ruler
Use Screen Ruler to quickly measure pixels on your screen based with image edge
detection. To activate, use the shortcut ⊞ Win + Shift + M . This was inspired by Pete
Blois's Rooler.
Shortcut Guide
Windows key shortcut guide appears when you press ⊞ Win + Shift + / (or as we like
to think, ⊞ Win + ? ) and shows the available shortcuts for the current state of the
desktop. You can also use press and hold ⊞ Win .
Text Extractor
Text Extractor is a convenient way to copy text from anywhere on your screen. To
activate, use the shortcut ⊞ Win + Shift + T . This code is based on Joe Finney's Text
Grab.
Languages
Currently, PowerToys is available in the following languages: Arabic (Saudi Arabia),
Chinese (simplified), Chinese (traditional), Czech, Dutch, English, French, German,
Hebrew, Hungarian, Italian, Japanese, Korean, Persian, Polish, Portuguese, Portuguese
(Brazil), Russian, Spanish, Turkish, Ukrainian.
[!VIDEO https://learn.microsoft.com/shows/Tabs-vs-Spaces/PowerToys-Utilities-to-
customize-Windows-10/player?format=ny]
Known issues
Search known issues or file a new issue in the Issues tab of the PowerToys repository
on GitHub. If you don't find the issue you are experiencing, you can Report a Bug on
the PowerToys product repo.
Before starting work on a feature that you would like to contribute, read the
Contributor's Guide . The PowerToys team will be happy to work with you to figure
out the best approach, provide guidance and mentorship throughout feature
development, and help avoid any wasted or duplicate effort.
PowerToys history
Inspired by the Windows 95 era PowerToys project , this reboot provides power users
with ways to squeeze more efficiency out of the Windows shell and customize it for
individual workflows. An overview of the original PowerToys can be found here: Using
Windows 95 PowerToys .
PowerToys roadmap
PowerToys is a rapid-incubation, open source team aimed at providing power users
ways to squeeze more efficiency out of the Windows shell and customize it for
individual workflows. Work priorities will consistently be examined, reassessed, and
adjusted with the aim of improving our users productivity.
Requirements
Supported Operating Systems:
Windows 11 (all versions)
Windows 10 v2004 (19041) or newer
System architecture
x64 and Arm64 architectures are currently supported.
Our installer will install the following runtimes:
Microsoft Edge WebView2 Runtime bootstrapper (this will always install the
latest version available)
To see if your machine meets these requirements, check your Windows version and
build number by opening a Run dialog (Win+R), then type winver and select OK or
Enter . Alternatively, enter the ver command in Windows Command Prompt. You may
be able to update to the latest Windows version in Windows Update.
PowerShell
Installer arguments
The installer executable accepts the Microsoft Standard Installer command-line options.
ノ Expand table
This PowerShell example assumes the default install location for WiX Toolset and the
PowerToys installer downloaded to the desktop.
PowerShell
cd $Env:WIX\"bin"
Clean-up scripts
In case there are problems with uninstalling a version, there are cleanup scripts
available:
<github.com/microsoft/PowerToys/tree/main/tools/CleanUp_tool>
<github.com/microsoft/PowerToys/tree/main/tools/CleanUp_tool_powershell_script>
PowerShell
PowerShell
PowerShell
To update PowerToys, run the following command from the command line / PowerShell:
PowerShell
If you have issues when installing/updating, file an issue in the Scoop repo on GitHub .
After installation
After successfully installing PowerToys, an overview window will display with
introductory guidance on each of the available utilities.
Updates
PowerToys uses an auto-updater that checks for new versions when the app is running.
If enabled, a toast notification will appear when an update is available. Updates can also
be checked for manually from the PowerToys Settings.
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
General settings for PowerToys
Article • 04/12/2024
Version
Here you can check for new updates and if one is available, you can download and
install it. You can set if updates should be downloaded automatically.
Administrator mode
Read more about the administrator mode in the PowerToys running with administrator
permissions section of the documentation.
App theme
Here you can set the theme of the PowerToys settings app and the PowerToys flyout:
Dark, Light, or Windows default.
Run at startup
If activated, PowerToys will start automatically when you log in to Windows.
Experimentation
Will activate experimentation with new features on Windows Insider builds, if available.
Options
There are two options for PowerToys to support applications running as administrator
(with elevated permissions):
These are the two scenarios PowerToys will not work in:
Always On Top
Pin windows that are elevated
FancyZones
Snapping an elevated window (e.g. Task Manager) into a Fancy Zone
Moving the elevated window to a different zone
File Locksmith
End elevated processes
Hosts file editor
Keyboard remapper
Key to key remapping
Global level shortcuts remapping
App-targeted shortcuts remapping
Mouse without Borders
Use Service
PowerToys Run
Use shortcut
Registry Preview
Write keys to the registry
Shortcut guide
Display shortcut
Video Conference Mute
The simplest way to run an app or program in administrative mode is to right-click the
program and select Run as administrator. If the current user is not an administrator,
Windows will ask for the administrator username and password.
If you see this User Account Control prompt, the application is requesting administrator
level elevated permission:
In the case of an elevated command line, typically the text "Administrator" will be
included in the title bar.
Since version 0.80, the PowerToys installer has been released on GitHub with
Microsoft.PowerToys.Configure DSC resource that allows you to configure PowerToys using
Installation
Prerequisites
PSDesiredStateConfiguration 2.0.7 or later: Refer to the PowerShell DSC documentation
for installation instructions.
PowerShell 7.2 or higher.
WinGet version v1.6.2631 or later .
Download
Microsoft.PowerToys.Configure is installed with PowerToys. Depending on the installer type,
it's installed as follows:
Usage
You can invoke the resource directly using the following Powershell syntax:
ps
YAML
properties:
resources:
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: installPowerToys
directives:
description: Install PowerToys
allowPrerelease: true
settings:
id: Microsoft.PowerToys
source: winget
- resource: Microsoft.PowerToys.Configure/PowerToysConfigure
dependsOn:
- installPowerToys
directives:
description: Configure PowerToys
settings:
ShortcutGuide:
Enabled: false
OverlayOpacity: 50
FancyZones:
Enabled: true
FancyzonesEditorHotkey: "Shift+Ctrl+Alt+F"
FileLocksmith:
Enabled: false
configurationVersion: 0.2.0
Use the following command to apply the configuration from the file:
ps
This command installs the latest version of PowerToys and uses the PowerToysConfigure
resource to apply settings for multiple PowerToys modules. More examples can be found in
the PowerToys repo .
AlwaysOnTop
ノ Expand table
app window.
Awake
ノ Expand table
ColorPicker
ノ Expand table
VisibleColorFormats — — ❌
7 Note
CropAndLock
ノ Expand table
EnvironmentVariables
ノ Expand table
FancyZones
ノ Expand table
7 Note
FileLocksmith
ノ Expand table
FindMyMouse
ノ Expand table
Hosts
ノ Expand table
ImageResizer
ノ Expand table
ImageresizerSizes — — ❌
ImageresizerCustomSize — — ❌
7 Note
Configuring custom sizes through DSC is not yet supported.
KeyboardManager
ノ Expand table
ActiveConfiguration — — ❌
KeyboardConfigurations — — ❌
7 Note
MeasureTool
Measure Tool is the internal name for Screen Ruler.
ノ Expand table
MouseHighlighter
ノ Expand table
MouseJump
ノ Expand table
MousePointerCrosshairs
ノ Expand table
MouseWithoutBorders
ノ Expand table
ノ Expand table
Peek
ノ Expand table
PowerAccent
PowerAccent is the internal name for Quick Accent.
ノ Expand table
PowerLauncher
PowerLaucher is the internal name for PowerToys Run.
ノ Expand table
ノ Expand table
IsGlobal Boolean The results for this plugin are shown in the global results
WeightBoost Int The weight modifier to help in ordering the results for this plugin
7 Note
PowerOcr
PowerOcr is the internal name for Text Extractor.
ノ Expand table
PowerPreview
ノ Expand table
PowerRename
ノ Expand table
RegistryPreview
ノ Expand table
DefaultRegApp Boolean Make Registry Preview default app for opening .reg files. ✅
ShortcutGuide
ノ Expand table
VideoConference
ノ Expand table
GeneralSettings
ノ Expand table
Contributing
Refer to the relevant devdocs section in the developer documentation to start working on
the DSC module.
6 Collaborate with us on
Windows developer feedback
GitHub
Windows developer is an open source
The source for this content can project. Select a link to provide
be found on GitHub, where you feedback:
can also create and review issues
and pull requests. For more Open a documentation issue
information, see our contributor
guide. Provide product feedback
Group Policies
Article • 01/30/2024
Since version 0.64, PowerToys is released on GitHub with Administrative Templates that
allows you to configure PowerToys using Group Policies.
How to install
Download
You can find the latest administrative templates (ADMX files) in the assets section of our
newest PowerToys release on GitHub . The file is named GroupPolicyObjectsFiles-
<Version>.zip .
Scope
You will find the policies under "Administrative Templates/Microsoft PowerToys" in both
the Computer Configuration and User Configuration folders. If both settings are
configured, the setting in Computer Configuration takes precedence over the setting in
User Configuration.
Policies
This policy configures the enabled state for all PowerToys utilities.
If you enable this setting, all utilities will be always enabled and the user won't be
able to disable it.
If you disable this setting, all utilities will be always disabled and the user won't be
able to enable it.
If you don't configure this setting, users are able to enable or disable the utilities.
The individual enabled state policies for the utilities will override this policy.
Registry information
Path: Software\Policies\PowerToys
Name: ConfigureGlobalUtilityEnabledState
Type: DWORD
Example value: 0x00000000
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys/ConfigureGlobalU
tilityEnabledState
For each utility shipped with PowerToys, there's a "Configure enabled state" policy,
which forces an enabled state for the utility.
If you enable this setting, the utility will be always enabled and the user won't be
able to disable them.
If you disable this setting, the utility will be always disabled and the user won't be
able to enable them.
If you don't configure this setting, users are able to enable or disable the utility.
These policies have a higher priority than, and will override, the policy "Configure global
utility enabled state".
7 Note
PDF file preview: There have been reports of incompatibility between the PDF
Preview Handler and Outlook.
ノ Expand table
Registry information
Path: Software\Policies\PowerToys
Name: See the table above.
Type: DWORD
Example value: 0x00000000
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys/<PolicyID>
7 Note
Allow experimentation
Supported on PowerToys 0.68.0 or later.
If this setting is enabled or not configured, the user can control experimentation in
the PowerToys settings menu.
If this setting is disabled, experimentation is not allowed.
Registry information
Path: Software\Policies\PowerToys
Name: AllowExperimentation
Type: DWORD
Example value: 0x00000000
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys/AllowExperimenta
tion
7 Note
Path: HKLM\Software\Policies\PowerToys
Name: DisablePerUserInstallation
Type: DWORD
Example value: 0x00000001
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~InstallerUpdates
/DisablePerUserInstallation
This policy configures whether the automatic download and installation of available
updates is disabled or not. Updates are never downloaded on metered connections.
Registry information
Path: Software\Policies\PowerToys
Name: DisableAutomaticUpdateDownload
Type: DWORD
Example value: 0x00000001
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~InstallerUpdates
/DisableAutomaticUpdateDownload
This policy configures whether the action center notification for new updates is
suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the
next notification is shown for the v0.63.* release.)
7 Note
Registry information
Path: Software\Policies\PowerToys
Name: SuspendNewUpdateToast
Type: DWORD
Example value: 0x00000001
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~InstallerUpdates
/SuspendNewUpdateToast
Example value: <enabled/>
This policy configures whether the action center notification for new updates is shown
or not.
Registry information
Path: Software\Policies\PowerToys
Name: DisableNewUpdateToast
Type: DWORD
Example value: 0x00000001
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~InstallerUpdates
/DisableNewUpdateToast
This policy allows you to configure if the window with the release notes is shown after
updates.
If enabled, the window with the release notes is not shown automatically.
If disabled or not configured, the user can control this in the settings of PowerToys.
Registry information
Path: Software\Policies\PowerToys
Name: DoNotShowWhatsNewAfterUpdates
Type: DWORD
Example value: 0x00000001
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~InstallerUpdates
/DoNotShowWhatsNewAfterUpdates
PowerToys Run
This policy configures the enabled state for all PowerToys Run plugins. All plugins will
have the same state.
If you enable this setting, the plugins will be always enabled and the user won't be
able to disable it.
If you disable this setting, the plugins will be always disabled and the user won't be
able to enable it.
If you don't configure this setting, users are able to enable or disable the plugins.
You can override this policy for individual plugins using the policy "Configure enabled
state for individual plugins".
7 Note
Registry information
Path: Software\Policies\PowerToys
Name: PowerToysRunAllPluginsEnabledState
Type: DWORD
Example value: 0x00000000
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~PowerToysRun/Pow
erToysRunAllPluginsEnabledState
With this policy you can configure an individual enabled state for each PowerToys Run
plugin that you add to the list.
If you enable this setting, you can define the list of plugins and their enabled states:
The value name (first column) is the plugin ID. You will find it in the plugin.json
file which is located in the plugin folder.
The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2
for user takes control.
Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0
If you disable or don't configure this policy, either the user or the policy "Configure
enabled state for all plugins" takes control over the enabled state of the plugins.
You can set the enabled state for all plugins not controlled by this policy using the
policy "Configure enabled state for all plugins".
7 Note
Registry information
Path: Software\Policies\PowerToys\PowerLauncherIndividualPluginEnabledList
Type: STRING
Example values:
Software\Policies\PowerToys\0778F0C264114FEC8A3DF59447CF0A74 = 2 (=>
User can enable/disable the OneNote plugin.)
Software\Policies\PowerToys\791FC278BA414111B8D1886DFE447410 = 0 (=>
Program plugin force disabled.)
Software\Policies\PowerToys\CEA0FDFC6D3B4085823D60DC76F28855 = 1 (=>
Calculator plugin force enabled.)
Intune information
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/PowerToys~Policy~PowerToys~PowerToysRun/Pow
erToysRunIndividualPluginEnabledState
Example value:
<enabled/>
<data id="PowerToysRunIndividualPluginEnabledList"
value="0778F0C264114FEC8A3DF59447CF0A742791FC278BA41411
1B8D1886DFE4474100CEA0FDFC6D3B4085823D60DC76F28855ð
00;1"/>
7 Note
Syntax for the value property from the data element: <PluginID>
<Number><PluginID><Number>
Pin a window
When you activate Always On Top (default: ⊞ Win + Ctrl + T ), the utility pins the active
window above all other windows. The pinned window stays on top, even when you
select other windows.
Settings
Always On Top has the following settings:
ノ Expand table
Setting Description
Do not activate Prevents the feature from being activated when actively playing a game on
when Game the system.
Mode is on
Show a border When On, this option shows a colored border around the pinned window.
around the
pinned window
Color mode Choose either Windows default or Custom color for the highlight border.
Setting Description
Color The custom color of the highlight border. Color is only available when Color
mode is set to Custom color.
Enable round When selected, the highlight border around the pinned window will have
corners rounded corners.
Play a sound When selected, this option plays a sound when you activate or deactivate
when pinning a Always On Top.
window
Excluded apps Prevents you from pinning an application using Always On Top. Add an
application's name to stop it from being pinned. The list will also exclude
partial matches. For example, Notepad will prevent both Notepad.exe and
Notepad++.exe from being pinned. To only prevent a specific application, add
Notepad.exe to the excluded list.
PowerToys Awake is a tool for Windows designed to keep a computer awake without
having to manage its power & sleep settings . This can be helpful when running time-
consuming tasks, ensuring that the computer does not go to sleep or turn off its
screens.
Getting started
You can use PowerToys Awake directly from PowerToys Settings or as a standalone
executable. When it's running from PowerToys, it can be managed from PowerToys
Settings or the system tray.
7 Note
PowerToys Awake does not modify any of the Windows power plan settings, and
does not depend on a custom power plan configuration. Instead, it spawns
background threads that tell Windows that they require a specific state of the
machine.
Settings
In the PowerToys Settings, start PowerToys Awake by toggling Enable Awake on. Once
enabled, the application will manage the awakeness state of the computer.
You can choose the following Awake states:
ノ Expand table
Setting Description
Keep using the selected The computer awakeness state is unaffected. The application is waiting
power plan for user input.
Keep awake indefinitely The computer stays awake indefinitely, until you explicitly put the
machine to sleep or close/disable the application.
Keep awake for a time Keep machine awake for a defined limited time. After the defined time,
interval Awake returns to the previous state.
7 Note
Changing the hours or minutes while the computer is kept awake temporarily will
reset the timer.
Keep screen on
While PowerToys Awake can keep the computer awake indefinitely or temporarily, in its
default state the displays connected to the machine will turn off. If you need the displays
to be available, use the Keep screen on switch, which will keep displays active.
This feature only works if Awake is running in one of the three Keep awake states. It
does not survive a computer restart.
System tray
To manage the execution of the tool from the system tray, right-click on the PowerToys
Awake icon.
ノ Expand table
Argument Description
--use-pt- Use the PowerToys configuration file to manage the settings. This assumes that
config there is a settings.json file for Awake, generated by PowerToys, that contains all
required runtime information. This includes the Behavior Mode (indefinite or
timed), whether screens should be kept on, and what the values for hours and
minutes are for a temporary keep-awake.
When this argument is used, all other arguments are ignored. Awake will look for
changes in the settings.json file to update its state.
--display- Keep displays on or off while the machine is kept awake. Expected values are true
on or false .
Argument Description
--time- Duration, in seconds, during which Awake keeps the computer awake. Can be used
limit in combination with --display-on .
--expire- Expiration date and/or time when Awake will turn off and resume the standard
at power state. Can be used in combination with --display-on .
--pid Attaches the execution of Awake to a Process ID (PID). When the process with a
given PID terminates, Awake terminates as well.
7 Note
When setting the value for the --time-limit parameter, both of these formats will be
accepted:
PowerToys.Awake.exe --time-limit=36000
When setting the value for the --expire-at parameter, these formats will be accepted
based on DateTime.Parse
13 2023
A system-wide color picking utility for Windows to pick colors from any screen and copy
it in a configurable format to the clipboard.
Getting started
Open editor opens an editor that lets you choose a color from the colors history,
fine-tune a selected color, or pick a new color
Pick a color and open editor activates Color Picker, then opens an editor and
copies the selected color to the clipboard after you've picked a color
Only pick a color activates Color Picker and copies the selected color to the
clipboard
Picking colors
After activating Color Picker, select a color on your screen to pick that color. If you want
to see the area under your cursor in more detail, scroll up to zoom in.
Color Picker copies the selected color to the clipboard in the Default color format
you've chosen in Color Picker's settings (default: HEX).
Tip
1. Move the mouse pointer close, but not over the element.
2. Zoom in by scrolling the mouse wheel up. Image will be frozen.
3. In the enlarged area, you can pick the color of the element.
The colored bar at the top of the Color Picker editor lets you:
To fine tune your chosen color, select the central color in the color bar. The fine-tuning
control lets you change the color's HSV, RGB, and HEX values. Select adds the new color
to the colors history.
To choose a similar color, select one of the segments on the top and bottom edges of
the color bar. Selecting one of these similar colors adds it to the history.
To remove a color from the history, right-click a color and select Remove.
To export the colors history, right-click a color and select Export. You can group the
values by colors or formats.
Settings
Color Picker has the following settings:
ノ Expand table
Setting Description
Activation Sets what happens when you activate Color Picker. Read more about this setting
behavior in Activating Color Picker.
Default color The color format that Color Picker copies to the clipboard.
format
Show color Shows a high-level representation of the color. For example, 'Light Green',
name 'Green', or 'Dark Green'.
Color formats Enable and add different color formats, and change the order of color formats in
the Color Picker editor. Read more about color formats in Managing color
formats.
Managing color formats
You can add, edit, delete, disable, and change the order of color formats in Color
formats.
To change the order that color formats appear in the Color Picker editor, select the more
button (•••) next to a color format and select Move up or Move down.
To disable a color format, turn off the toggle next to that color format. Color Picker
doesn't show disabled color formats in the editor.
To delete a color format, select the more button (•••) next to a color format and select
Delete.
To add a new color format, select Add custom color format. Enter the color format's
Name and Format. The syntax for color formats is described in the dialog.
To edit a color format, select it from the list. Edit the color format's Name and Format in
the Edit custom color format dialog. The syntax for color formats is described in the
dialog.
ノ Expand table
Parameter Meaning
%Re red
%Gr green
%Bl blue
%Al alpha
%Cy cyan
%Ma magenta
%Ye yellow
%Hu hue
%Br brightness
%In intensity
%Va value
%Wh whiteness
%Bn blackness
%Ca chromaticity A
%Cb chromaticity B
%Xv X value
%Yv Y value
%Zv Z value
Format the red, green, blue and alpha values to the following formats:
ノ Expand table
Formatter Meaning
For example %ReX means the red value in hex uppercase two digits format.
Color formats can contain any words or characters that you prefer. For example, the
default color format, which shows up on color format creation is: _'new Color (R = %Re,
G = %Gr, B = %Bl)'_ .
Limitations
Color Picker can't display on top of the Start menu or Action Center, but you can
still pick a color.
If you started the currently focused application with an administrator elevation
(Run as administrator), the Color Picker activation shortcut won't work, unless you
also started PowerToys with administrator elevation.
Wide Color Gamut (WCG) and High Dynamic Range (HDR) color formats are
currently not supported.
) Important
There are some incompatibilities between Command Not Found and some
PowerShell configurations. Read more about them in issue 30818 on GitHub.
Requirements
PowerShell 7
PowerShell Microsoft.WinGet.Client module
PSFeedbackProvider
PSCommandNotFoundSuggestion
After that, the PowerShell profile file will be appended with following block of
PowerShell commands:
psh
Note: The profile file will be created if needed. Restart PowerShell session to use the
module.
PowerToys Crop And Lock allows you to crop a current application into a smaller
window or just create a thumbnail. Focus the target window and press the shortcut to
start cropping.
Getting started
How to use
To start using Crop And Lock, enable it in PowerToys Settings.
Once enabled, focus a Window and press the "Thumbnail" shortcut (default: ⊞ Win +
Ctrl + Shift + T ) or the "Reparent" shortcut (default: ⊞ Win + Ctrl + Shift + R ) to
select an area of the window to crop.
Tip
After you've selected the area of the window, a new window will appear and behave
according to the selected crop mode.
Select the Close button of the cropped window to close it and restore the original
window.
Crop modes
Thumbnail
Creates a window that shows the selected area of the original window. Any changes to
the original window's selected area will be reflected on the thumbnail, but the original
application can't be controlled through the thumbnail. This mode has the best
compatibility.
Reparent
Creates a window that replaces the original window, showing only the selected area. The
application will now be controlled through the cropped window. Closing the cropped
window will restore the original window. Not every window will react well to being
contained in another application so this mode has many compatibility issues. It's
advisable to use the "Thumbnail" mode instead if you find that a windows isn't reacting
well to being cropped with the "Reparent" mode.
Known issues
Cropping maximized or full-screen windows in "Reparent" mode might not work.
It's recommended to resize the window to fill the screen corners instead.
Some UWP apps won't react well to being cropped in "Reparent" mode. Windows
Calculator is a notable example of this.
Applications that use sub-windows or tabs can react poorly to being cropped in
"Reparent" mode. Notepad and OneNote are notable examples of applications
that react poorly.
Edit/Remove variable
To edit or remove a variable (profile, User or System), select the more button (•••) on the
desired variable:
Add profile
To add a new profile:
To edit or remove a profile, select the more button (•••) on the desired profile.
Apply profile
To apply a profile, set the profile toggle to On. Only one profile can be applied at a time.
The Applied variables list will show applied profile variables at the top (below Path
variable):
Settings
From the settings, the following options can be configured:
ノ Expand table
Setting Description
Open as Allow management of System variables. If off, only profile and User variables
administrator can be modified. Environment Variables is opened as administrator by default.
FancyZones is a window manager utility for arranging and snapping windows into
efficient layouts to improve your workflow and restore layouts quickly. You can define a
set of zone locations to use as targets for windows on your desktop. When you drag a
window into a zone, or use the associated keyboard shortcut, the window is resized and
repositioned to fill that zone.
You can also trigger zone selection mode by using a non-primary mouse button if Use
non-primary mouse button to toggle zone activation is selected.
If both Hold Shift key to activate zones while dragging and Use non-primary mouse
button to toggle zone activation are cleared, zones will appear immediately after you
start dragging the window.
Window switching
When two or more windows are snapped in the same zone, cycle between the snapped
windows in that zone by using the shortcut Win + PgUp/PgDn .
Shortcut keys
ノ Expand table
Shortcut Action
⊞ Win + Shift + ` Opens the editor (this shortcut can be changed in the Settings window)
⊞ Win + Left/Right Move focused window between zones (only if Override Windows Snap
hotkeys is selected and Zone index is chosen; in that case only the
⊞ Win + Left and ⊞ Win + Right are overridden, while the ⊞ Win
+ Up and ⊞ Win + Down keep working as usual)
⊞ Win + Move focused window between zones (only if Override Windows Snap
Left/Right/Up/Down hotkeys is selected and Relative position is chosen; in that case all the
⊞ Win + Left , ⊞ Win + Right , ⊞ Win + Up and ⊞ Win + Down are
overridden)
⊞ Win + Ctrl + Alt + Quickly apply custom layout (you need to assign number to the custom
[number] layout in the editor first)
FancyZones doesn't override the Windows ⊞ Win + Shift +[arrow keys] to quickly move
a window to an adjacent monitor.
Show space around zones sets the size of margin around each FancyZone window.
Enter a custom width of the margin in Space around zones. With the layout editor open,
change Show space around zones after changing the values to see the new value
applied.
Distance to highlight adjacent zones sets a custom value for the amount of space
between zones until they snap together, or before both are highlighted enabling them
to merge together.
Default layout for horizontal monitor orientation and Default layout for vertical
monitor orientation set which layout to use as the default when the display
configuration is changed in the system (for example, if you add a new display).
Creating a custom layout
Select Create new layout at the bottom.
There are two styles of custom zone layouts: Grid and Canvas.
The Grid model starts with a three column grid and allows zones to be created by
splitting and merging zones, moving the gutter between zones as desired. This is a
relative layout and will resize with different screen sizes. You can edit the layout using
mouse or keyboard.
Mouse
To divide a zone: click your mouse. To rotate the divider: hold down Shift .
To move a divider: click on the thumb and drag or select the thumb by focusing
the layout.
To merge/delete zones: select a zone, hold the left mouse button and drag the
mouse until multiple zones are selected. Release the button and a popup menu
will show up. Select Merge and they will become one zone. This is how a zone
should be deleted, by merging it into another zone.
Keyboard
First, focus the layout by pressing Ctrl + Tab . All zones and dividers can be
focused by pressing Tab .
To divide a zone: focus the zone you want to divide and press S or Shift + S to
divide it.
To move a divider: focus the divider and press arrow keys to move it.
To merge/delete zones: focus the divider between zones and press Delete . All
zones adjacent to deleted divider will be merged into one zone.
The Canvas model starts with one zone and supports adding zones that can be moved
and resized, similar to windows. Zones in the canvas model may be overlapping.
Canvas layout also has keyboard support for zone editing. Use the arrow keys (Left,
Right, Up, Down) to move a zone by 10 pixels, or Ctrl +arrow to move a zone by 1
pixel. Use Shift +arrow to resize a zone by 10 pixels (5 per edge), or Ctrl + Shift
+arrow to resize a zone by 2 pixels (1 per edge). To switch between the editor and
dialog, press Ctrl + Tab .
Quickly changing between custom layouts
7 Note
In the demo below, we start with a default template applied to the screen and two
custom layouts that we assign hotkeys for. We then use the Win + Ctrl + Alt +[number]
binding to apply the first custom layout and snap a window to it. Finally, we apply the
second custom layout while dragging a window and snap the window to it.
Tip
The settings for custom zone layouts are saved in the file
%LocalAppData%\Microsoft\PowerToys\FancyZones\custom-layouts.json . This file can
be manually changed to tweak zones, and exported to share layouts across devices.
Other json files in the same directory can be modified to alter settings for monitors,
layout hotkeys, etc. Be warned that editing these files is not recommended as it
may cause other issues with FancyZones functionality.
Settings
ノ Expand table
Setting Description
Activation shortcut To change the default hotkey, click on the control and enter the
desired key combination.
Open editor on the display Select where the Editor will show.
Hold Shift key to activate Toggles between auto-snap mode with the Shift key
zones while dragging (disabling snapping during a drag) and manual snap mode
where pressing the Shift key during a drag enables snapping.
Setting Description
Use a non-primary mouse Clicking a non-primary mouse button toggles the zones
button to toggle zone activation
activation
Use middle mouse button to Use the middle mouse button to select multiple zones
toggle multiple zones
spanning
Show zones on all monitors By default, FancyZones shows only the zones available on the
while dragging a window focused monitor. (This feature may have a performance impact
when selected)
Allow zones to span across Treat all connected monitors as one large screen. To work
monitors (all monitors must correctly, it requires all monitors to have the same DPI scaling
have the same DPI scaling) factor. (There might be unexpected effects when using monitors
in different orientations)
When multiple zones overlap Choose how to deal with overlapping zones.
Show zone number Should the number of the zone be visible when layout is shown
Opacity (%) The percentage of opacity of active and inactive zones. (default:
50%)
Highlight color The color of a zone when it is the active drop target during the
dragging of a window.
Inactive color The color of zones when they are not an active drop during the
dragging of a window.
Border color The color of the border of active and inactive zones.
Keep windows in their zones FancyZones will resize and reposition windows into the zones
when the screen resolution they were previously in, after a screen resolution change.
changes
During zone layout changes, FancyZones will resize and position windows into the new zone
windows assigned to a zone layout by maintaining the previous zone number location of
will match new size/position each window.
Move newly created windows Automatically move a newly opened window into the last zone
to the last known zone location that application was in.
Move newly created windows When this option is selected, and Move newly created windows
to the current active monitor to the last known zone is cleared or the application doesn't
Setting Description
Restore the original size of Unsnapping a window will restore its size as before it was
windows when unsnapping snapped.
Make dragged window When the zones are activated, the window being dragged is
transparent made transparent to improve the layout visibility.
Allow popup windows Popup windows couldn't be snapped by default. However, this
snapping could be the reason why some windows don't trigger
FancyZones when dragging. This setting affects all popup
windows including notifications.
Allow child windows snapping Child windows couldn't be snapped by default. However, this
could be the reason why some windows don't trigger
FancyZones when dragging.
Switch between windows in Allows cycling activation between windows in the same zone.
the current zone
Next window To change the default hotkey, click on the control and then
enter the desired key combination.
Previous window To change the default hotkey, click on the control and then
enter the desired key combination.
Override Windows Snap When this option is checked and FancyZones is running, it
hotkeys (Win + arrow) to move overrides the Windows Snap keys: ⊞ Win + Left , ⊞ Win +
between zones Right , ⊞ Win + Up and ⊞ Win + Down .
Move windows based on Zone index allows to use ⊞ Win + Left and ⊞ Win + Right
to snap a window based on its index. ⊞ Win + Up , ⊞ Win +
Down are not overridden.
Relative position overwrites all ⊞ Win +[arrow keys] and
chooses zone to snap relative to the zone layout
Move windows between zones Cleared: snapping with ⊞ Win +[arrow keys] cycles the window
across all monitors through the zones on the current monitor.
Selected: it cycles the window through all the zones on all
monitors.
Enable quick layout switch Enables hotkeys to quickly changes layouts - see individual
layout settings.
Flash zones when switching The zones will flash when a layout is selected via the shortcut.
Setting Description
layout
Exclude applications from Add an application's name, or part of the name, one per line
snapping to zones (e.g. adding Notepad will match both Notepad.exe and
Notepad++.exe ; to match only Notepad.exe add the .exe
extension)
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
File Explorer add-ons utility
Article • 04/12/2024
2 Warning
Enabling the preview handlers will override other preview handlers already installed
- there have been reports of incompatibility between Outlook and the PDF Preview
Handler.
ノ Expand table
Setting Description
Try to format the source for Enable or disable formatting of the source code for json and
preview xml files.
The original file stays unchanged.
If the preview pane does not appear to work after setting the extension to On, there is
an advanced setting in Windows that may be blocking the preview handler. Go to
Options in Windows File Explorer and under the View tab, you will see a list of
Advanced settings. Ensure that Show preview handlers in preview pane is selected in
order for the preview pane to display.
Enabling the Explorer pane in Windows 11
Open Windows File Explorer, go to View in the Explorer ribbon and select Preview pane.
7 Note
It is not possible to change the background color of the preview pane, so if you are
working with transparent images with white shapes, you may not be able to see
them in the preview.
Thumbnail Previews
To enable thumbnail preview support, set the extension to On.
7 Note
A reboot may be required after enabling the thumbnail previewer for the settings
to take effect. Thumbnails might not appear on paths managed by cloud storage
solutions like OneDrive, since these solutions may get their thumbnails from the
cloud instead of generating them locally.
File Locksmith is a Windows shell extension for checking which files are in use and by
which processes.
When File Locksmith is opened, it will scan all of the running processes that it can
access, checking which files the processes are using. Processes that are being run by a
different user cannot be accessed and may be missing from the list of results. To scan all
processes, select Restart as administrator.
After scanning, a list of processes will be displayed. Select End task to terminate the
process, or select the expander to show more information. File Locksmith will
automatically remove terminated processes from the list, whether or not this action was
done via File Locksmith. To manually refresh the list of processes, select Reload.
See also
PowerToys overview
Installing PowerToys
Windows includes a local "Hosts" file that contains domain names and matching IP
addresses, acting as a map to identify and locate hosts on IP networks. Every time you
visit a website, your computer will check the hosts file first to see which IP address it
connects to. If the information is not there, your internet service provider will look into
the Domain Name Server (DNS) for the resources to load the site. The Hosts File Editor
provides a convenient way to edit the hosts file. This can be useful for scenarios like
migrating a website to a new hosting provider or domain name, which may take a 24-48
hour period of downtime. Creating a custom IP address to associate with your domain
using the hosts file can enable you to see how it will look on the new server.
Settings
From the Settings menu, the following options can be configured:
ノ Expand table
Setting Description
Open as administrator Open as administrator to be able edit the hosts file. If disabled, the
editor is run in read-only mode. Hosts File Editor is started as
administrator by default.
Setting Description
Show a warning at Warns that editing hosts can change DNS names resolution. Enabled
startup by default.
Additional lines position Default value is Top. If Bottom is selected, the file header is moved
below hosts settings to the bottom.
Consider loopback Loopback addresses (like 127.0.0.1 and ::1) are considered as
addresses as duplicates duplicates.
Troubleshooting
A "Failed to save hosts file" message appears if a change is made without administrator
permissions:
Image Resizer is a Windows shell extension for bulk image-resizing. After installing
PowerToys, right-click on one or more selected image files in File Explorer, and select
Resize with ImageResizer from the menu.
Image Resizer allows you to resize images by dragging and dropping your selected files
with the right mouse button. This way, resized pictures can quickly be saved in a folder.
7 Note
If Ignore the orientation of pictures is selected, the width and height of the
specified size may be swapped to match the orientation (portrait/landscape) of the
current image. In other words: If selected, the smallest number (in width/height) in
the settings will be applied to the smallest dimension of the picture. Regardless if
this is declared as width or height. The idea is that different photos with different
orientations will still be the same size.
Settings
On the Image Resizer page, configure the following settings.
Sizes
Add new preset sizes. Each size can be configured as Fill, Fit or Stretch. The dimension to
be used for resizing can be centimeters, inches, percent and pixels.
Fill: Fills the entire specified size with the image. Scales the image proportionally.
Crops the image as needed.
Fit: Fits the entire image into the specified size. Scales the image proportionally.
Does not crop the image.
Stretch: Fills the entire specified size with the image. Stretches the image
disproportionally as needed. Does not crop the image.
Tip
You can leave the width or height empty. The dimension will be calculated to a
value proportional to the original image aspect ratio.
Fallback encoding
The fallback encoder is used when the file cannot be saved in its original format. For
example, the Windows Meta File (.wmf) image format has a decoder to read the image,
but no encoder to write a new image. In this case, the image cannot be saved in its
original format. Specify the format the fallback encoder will use: PNG, JPEG, TIFF, BMP,
GIF, or WMPhoto settings. This is not a file type conversion tool, but only works as a
fallback for unsupported file formats.
File
The file name of the resized image can use the following parameters:
ノ Expand table
Parameter Result
%1 Original filename
%3 Selected width
%4 Selected height
Parameter Result
%5 Actual height
%6 Actual width
Example: setting the filename format to %1 (%2) on the file example.png and selecting
the Small file size setting, would result in the file name example (Small).png . Setting
the format to %1_%4 on the file example.jpg and selecting the size setting Medium 1366 ×
768px would result in the file name example_768.jpg .
You can specify a directory in the filename format to group resized images into sub-
directories. Example: a value of %2\%1 would save the resized image(s) to
Small\example.jpg
You can choose to retain the original last modified date on the resized image or reset it
at time of the resizing action.
See also
Microsoft PowerToys overview
Installing PowerToys
General settings for PowerToys
The PowerToys Keyboard Manager enables you to redefine keys on your keyboard.
For example, you can exchange the letter A for the letter B on your keyboard. When
you press the A key, a B will be inserted.
You can exchange shortcut key combinations. For example: The shortcut key Ctrl + C
will copy text in many applications. With PowerToys Keyboard Manager utility, you can
swap that shortcut for ⊞ Win + C . Now, ⊞ Win + C will copy text. If you do not specify a
targeted application in PowerToys Keyboard Manager, the shortcut exchange will be
applied globally across Windows.
Also, you can exchange key or shortcut to arbitrary unicode text sequence. For example,
you can exchange the letter H for the text Hello! . When you press the H key, Hello!
will be inserted. Similarly, you can use shortcut Ctrl + G to send some text (e.g. Hello
from shortcut! ).
PowerToys Keyboard Manager must be enabled (with PowerToys running in the
background) for remapped keys and shortcuts to be applied. If PowerToys is not
running, key remapping will no longer be applied.
) Important
There are some shortcut keys that are reserved by the operating system or cannot
be replaced. Keys that cannot be remapped include:
⊞ Win + L and Ctrl + Alt + Del cannot be remapped as they are reserved by
the Windows OS.
The Fn (function) key cannot be remapped (in most cases). The F1 ~ F12
Settings
To create mappings with Keyboard Manager, open the PowerToys Settings. In PowerToys
Settings, on the Keyboard Manager tab, you will see options to:
Remapping keys
To remap a key, open the Remap Keyboard settings window with Remap a Key. When
first opened, no predefined mappings will be displayed. Select Add key remapping to
add a new remap. Note that various keyboard keys actually send a shortcut.
Once a new remap row appears, select the input key whose output you want to change
in the “Select” column. Select the new key, shortcut or text value to assign in the “To
send” column.
Select: To send:
A B
To swap key positions between the A and B keys, add another remapping with:
ノ Expand table
Select: To send:
B A
For example, to press the Ctrl key and have it result in ⊞ Win + ← (left arrow):
ノ Expand table
Select: To send:
Ctrl ⊞ Win + ←
) Important
Key remapping will be maintained even if the remapped key is used inside another
shortcut. The order of key press matters in this scenario as the action is executed
during key-down, not key-up. For example, pressing Ctrl + C would result as ⊞
Win + left arrow + C . Pressing the Ctrl key will first execute ⊞ Win + left
arrow . Pressing the C key first will execute C + ⊞ Win + left arrow .
ノ Expand table
Select: To send:
H Hello!
Remapping shortcuts
To remap a shortcut key combination, like Ctrl + C , select Remap a shortcut to open
the Remap Shortcuts settings window.
When first opened, no predefined mappings will be displayed. Select Add shortcut
remapping to add a new remap.
When a new remap row appears, select the input keys whose output you want to
change in the “Select” column. Select the new shortcut value to assign in the “To send”
column.
For example, the shortcut Ctrl + C copies selected text. To remap that shortcut to use
the Alt key, rather than the Ctrl key:
ノ Expand table
Select: To send:
Alt + C Ctrl + C
There are a few rules to follow when remapping shortcuts. These rules only apply to the
"Shortcut" column.
Shortcuts must begin with a modifier key: Ctrl , Shift , Alt , or ⊞ Win
Shortcuts must end with an action key (all non-modifier keys): A, B, C, 1, 2, 3, etc.
Shortcuts cannot exceed four keys in length, or five if the shortcut is a 'chord'.
Shortcuts can be created with one or more modifiers and two non-modifier keys. These
are called "chords". In order to create a chord, select Edit to open the dialog to record
the shortcut using the keyboard. Once opened, toggle on the Allow chords switch. This
allows you to enter two non-modifier keys. For example, you can create shortcuts using
a chord based on 'V' for Volume Up and Volume Down like this:
ノ Expand table
Select: To send:
Chords are handy if you have a number of shortcuts that are similar, and it makes sense
to have them all start with the same non-modifier key.
For example, to replace the shortcut ⊞ Win + ← (left arrow) with a single key press Alt:
ノ Expand table
Select: To send:
⊞ Win + ← Alt
) Important
Shortcut remapping will be maintained even if the remapped key is used inside
another shortcut. The order of key press matters in this scenario as the action is
executed during key-down, not key-up. For example: pressing ⊞ Win + ← + Shift
ノ Expand table
Select: To send:
Ctrl + G Hello!
ノ Expand table
Option Meaning
Elevation Specify the elevation level to start the app. The options include Normal, Elevated, and
Different User.
Option Meaning
If What action should be taken when this shortcut is activated while the app is already
running running? The options are: Show Window, Start another instance, Do nothing, Close,
End task.
Visibility The app will be visible. This is useful if the app is a console or something you don't
want to see.
App-specific shortcuts
Keyboard Manager enables you to remap shortcuts for only specific apps (rather than
globally across Windows).
For example, in the Outlook email app the shortcut Ctrl + E is set by default to search
for an email. If you prefer instead to set Ctrl + F to search your email (rather than
forward an email as set by default), you can remap the shortcut with "Outlook" set as
your "Target app".
Keyboard Manager uses process-names (not application names) to target apps. For
example, Microsoft Edge is set as "msedge" (process name), not "Microsoft Edge"
(application name). To find an application's process name, open PowerShell and enter
the command get-process or open Command Prompt and enter the command
tasklist . This will result in a list of process names for all applications you currently have
ノ Expand table
OneNote onenote.exe
Outlook outlook.exe
Teams ms-teams.exe
Excel excel.exe
Word winword.exe
Powerpoint powerpnt.exe
Select Select.
Use the drop-down menu.
Once you select Select, a dialog window will open in which you can enter the key or
shortcut, using your keyboard. Once you’re satisfied with the output, hold Enter to
continue. To leave the dialog, hold Esc .
Using the drop-down menu, you can search with the key name and additional drop-
down values will appear as you progress. However, you can not use the type-key feature
while the drop-down menu is open.
Orphaning Keys
Orphaning a key means that you mapped it to another key and no longer have anything
mapped to it. For example, if the key is remapped from A to B , then a key no longer
exists on your keyboard that results in A . To remind you of this, a warning will display
for any orphaned keys. To fix this, create another remapped key that is mapped to result
in A .
Frequently asked questions
I see keys listed in the drop down menus that don't work.
Why is that?
Keyboard Manager lists mappings for all known physical keyboard keys. Some of these
mappings may not be available on your keyboard as there may not be a physical key
that it corresponds to. For instance: the Start App 1 option shown below is only
available on keyboards that physically have a Start App 1 key. Trying to map to and
from this key on a keyboard that does not support the Start App 1 key will result in
undefined behavior.
Troubleshooting
If you have tried to remap a key or shortcut and are having trouble, it could be one of
the following issues:
Run As Admin: Remapping will not work on an app or window if that window is
running in administrator (elevated) mode and PowerToys is not running as
administrator. Try running PowerToys as an administrator.
Not intercepting keys: Keyboard Manager intercepts keyboard hooks to remap
your keys. Some apps that also do this can interfere with Keyboard Manager. To fix
this, go to the settings, disable and enable Keyboard Manager.
Known Issues
Keyboard Manager should not be used when playing video games. Keyboard
Manager interception of key presses currently will impact the FPS.
Remapping keys like Win, Ctrl, Alt or Shift may break gestures and some special
keys
AltGr and Ctrl+Alt gives issues, since AltGr behaves as (L)Ctrl + (R)Alt and
remapping one of these keys can break the function.
Note that some keyboard keys actually send a shortcut. Common examples are the
Office key (Win+Ctrl+Alt+Shift) and the Copilot key (Win + C or Left-Shift +
Windows key + F23).
Mouse utilities is a collection of features that enhance mouse and cursor functionality
on Windows.
Find my mouse
Activate a spotlight that focuses on the cursor's position by pressing the Ctrl key twice,
using a custom shortcut or by shaking the mouse. Click the mouse or press any
keyboard key to dismiss it. If you move the mouse while the spotlight is active, the
spotlight will dismiss on its own shortly after the mouse stops moving.
Settings
From the settings page, the following options can be configured:
ノ Expand table
Setting Description
Activation method Choose between Press Left Ctrl twice, Press Right Ctrl twice, Shake
mouse or Custom shortcut.
Setting Description
Do not activate when Prevents the spotlight from being used when actively playing a game on
Game Mode is on the system.
Spotlight color The color of the circle that centers on the cursor. (default: #FFFFFF)
Spotlight radius The radius of the circle that centers on the cursor. (default: 100px)
Spotlight initial zoom The spotlight animation's zoom factor. Higher values result in more
pronounced zoom animation as the spotlight closes in on the cursor
position.
Excluded apps Add an application's name, or part of the name, one per line (e.g. adding
Notepad will match both Notepad.exe and Notepad++.exe ; to match only
Notepad.exe add the .exe extension).
Mouse Highlighter
Display visual indicators when the left or right mouse buttons are clicked. By default,
mouse highlighting can be turned on and off with the Win + Shift + H shortcut.
Settings
From the settings page, the following options can be configured:
ノ Expand table
Setting Description
Left button highlight The highlighter color for the left mouse button.
color
Right button highlight The highlighter color for the right mouse button.
color
Fade delay How long it takes before a highlight starts to disappear - Measured in
milliseconds.
Mouse jump allows moving the mouse pointer long distances on a single screen or
across multiple screens.
ノ Expand table
Setting Description
Activation shortcut The customizable keyboard command to activate the mouse jump.
ノ Expand table
Setting Description
Mouse Without Borders enables you to control up to 4 computers from the same
machine.
Features:
Initial configuration
1. Open Mouse Without borders in PowerToys Settings to configure your
connections.
2. On the first computer, select New Key to generate a security key for connecting.
3. On the second computer, enter the security key that was generated on the first
computer and the name of the first computer. Then select Connect.
4. Once the computers are connected, you will be able to move between them by
moving your mouse cursor beyond the edge of the screen.
It's possible to switch the order of the devices by dragging the device icon to a new
position in the layout.
Install Mouse Without Borders as a service
To allow Mouse Without Borders to control elevated applications or the lock screen
from another computer, it's possible to run Mouse Without Borders as a service under
the System account.
To enable the service mode, run PowerToys in administrator mode and turn on the Use
Service toggle.
2 Warning
Running Mouse Without Borders as a service account brings added control and
ease of use to the controlled machines, but this also brings some additional
security risks in case someone wants to use Mouse Without Borders as an attack
vector. Be mindful of your risk tolerance.
Setting Description
New key Generate a new key for the machine and resets current connections.
Security key Represents the security key used between the connected machines.
Can only be changed by generating a new key.
Connect Connect to other machines knowing the other machine's name and
security key.
Device layout Allows arranging the machine's position relative to each other by
dragging the machines in the layout.
Refresh connections Select this button to refresh the connections this machine has to the
other machines.
Devices in a single row Arrange the devices in a single row or in a 2x2 matrix.
Use Service Install Mouse Without Borders as a service to allow controlling the
lock screen and elevated applications.
Wrap mouse Wraps the mouse around to the first machine, after passing the edge
of the last machine and vice-versa.
Share clipboard
Transfer file Files can be copied via the clipboard. Limit is 100 MB.
Hide mouse at the Position the mouse cursor of one machine at the top edge of the
screen's edge screen when switching to another machine.
Draw mouse cursor Attempt to draw the mouse cursor on machines that have no physical
peripheral attached.
Validate remote machine Use reverse DNS lookup to validate remote machines IP addresses.
IP
Block screen saver on Prevent the screen saver from starting on other machines.
other machines
Move mouse relatively May help in solving issues when the machine's resolutions are
different or there are multiple screen scenarios.
Setting Description
Block mouse at screen Avoid accidentally switching machines when the mouse pointer is at
corners screen corners.
Show clipboard and Show clipboard activities and network status in system tray
network status messages notifications.
Easy Mouse Use the mouse pointer to switch between machines at screen edges.
Can also be configured to need to select Shift or Control to switch
between machines.
Shortcut to toggle Easy Set a Ctrl + Alt +<letter> shortcut to toggle Easy Mouse.
Mouse
Shortcut to lock all Set a Ctrl + Alt +<letter> shortcut to press twice to lock all
machines machines. Only works in the machines that have the same setting.
Shortcut to switch to Set a Ctrl + Alt +<letter> shortcut to start sending the same input
multiple machine mode to all machines at the same time.
Add a firewall rule for Install a firewall rule for Mouse Without Borders.
Mouse Without Borders
Show the original Mouse Show the original UI from Mouse Without Borders through the
Without Borders UI original tray icon. Mouse Without Borders needs to be restarted for it
to take effect.
Status Colors
The following colors are used to indicate the connection status to the user when trying
to connect to another computer:
ノ Expand table
Troubleshooting
If you can't setup the initial connection:
Known Issues
Copy/Paste between machines only works with a single file and the size limit is
100MB.
Drag/Drop between machines works with single file only and it does not work with
network files.
Copy/Paste, Drag/Drop does not work with folder and multiple files, the
workaround is to zip them first.
If the host machine has a full-screen focused Remote Desktop/virtual machine
window (or some kind of simulator window), the keyboard might not follow the
mouse to another machine. The workaround is to enable the option Hide mouse
at screen edge in the Settings or switch the focus to another window first.
The mouse pointer might be invisible if there is no physical mouse attached to the
machine. Plug in an unused mouse or turn on Mouse Keys in Control Panel.
Some settings may not sync correctly and may need to be manually changed to be
the same on all machines.
PowerToys Paste as Plain Text enables you to paste text stored in your clipboard,
excluding any text-formatting, using a quick key shortcut. Any formatting included with
the clipboard text will be replaced with an unformatted version of the text.
Getting started
Enabling
To start using Paste as Plain Text, enable it in the PowerToys Settings.
Activating
Execute the paste as plain text action with the activation shortcut (default: Ctrl + Win +
Alt + V ).
Settings
From the Settings menu, the following options can be configured:
ノ Expand table
Setting Description
It's possible to set Ctrl + V as the activation shortcut. This is not recommended, as
overriding this shortcut may have unintended consequences.
A system-wide utility for Windows to preview file content without the need to open
multiple applications or interrupt your workflow. It offers a seamless and quick file
preview experience for various file types, including images, Office documents, web
pages, Markdown files, text files, and developer files.
Preview a file
Select a file in File Explorer and open the Peek preview using the activation /
deactivation shortcut (default: Ctrl + Space ).
Using Left and Right or Up and Down , you can scroll between all files in the current
folder. Select multiple files in File Explorer for previewing to scroll only between selected
ones.
Settings
From the settings page, the following options can be configured:
ノ Expand table
Setting Description
Always run not elevated, even when Tries to run Peek without elevated permissions, to fix
PowerToys is elevated access to network shares.
Modify the file names of a large number of files, without giving all of the files the
same name.
Perform a search and replace on a targeted section of file names.
Perform a regular expression rename on multiple files.
Check expected rename results in a preview window before finalizing a bulk
rename.
Undo a rename operation after it is completed.
Demo
In this demo, all instances of the file name "foo" are replaced with "foobar". Since all of
the files are uniquely named, this would have taken a long time to complete manually
one-by-one. PowerRename enables a single bulk rename. Notice that the Explorer's
"Undo Rename" (Ctrl+Z) command makes it possible to undo the last change.
PowerRename window
After selecting files in Windows File Explorer, right-click and select Rename with
PowerRename (which will appear only if enabled in PowerToys). The selected items will
be displayed, along with search and replace values, a list of options, and a preview pane
displaying results of the search and replace values entered.
Search for
Enter text or a regular expression to find the files in your selection that contain the
criteria matching your entry. You will see the matching items in the Preview pane.
Replace with
Enter text to replace the Search for value entered previously. You can see the original file
name and renamed file name in the Preview pane.
For more information regarding the Use Boost library option in the settings menu for
extended regex functionalities, see the regular expressions section.
Match all occurrences
If selected, all matches of text in the Search field will be replaced with the Replace text.
Otherwise, only the first instance of the Search for text in the file name will be replaced.
Case sensitive
If selected, the text specified in the Search field will only match text in the items if the
text is the same case. Case matching will be insensitive by default.
Include files
Clearing causes files to not be included in the operation.
Include folders
Clearing causes folders to not be included in the operation.
Include subfolders
Clearing causes files within folders to not be included in the operation. By default, all
subfolder items are included.
Text formatting
Choose between four options to either convert items to be all lowercase, all uppercase,
title case (first character of sentence is capitalized), or capitalize every word.
Enumerate items
If selected, you can use the following patterns as part of the Replace with text:
ノ Expand table
${} A simple counter that will start from zero for the first renamed file.
${padding=X} A counter with a specified number of leading zeroes for the number.
You can also use multiple counters in the same replace string and combine
customizations.
a.jpg
ab.jpg
abc.jpg
Image_0010_.jpg
Image_0012_b.jpg
Image_0014_bc.jpg
Variable Explanation
pattern
$YYYY Year, represented by a full four or five digits, depending on the calendar used.
$YY Year, represented only by the last two digits. A leading zero is added for single-
digit years.
$DD Day of the month, as digits with leading zeros for single-digit days.
$D Day of the month, as digits without leading zeros for single-digit days.
Nov-02-20-powertoys.png
Nov-03-20-powertoys-menu.png
Regular expressions
For most use cases, a simple search and replace is sufficient. There may be occasions,
however, in which complicated renaming tasks require more control. Regular
Expressions can help.
Regular Expressions define a search pattern for text. They can be used to search, edit
and manipulate text. The pattern defined by the regular expression may match once,
several times, or not at all for a given string. PowerRename uses the ECMAScript
grammar, which is common amongst modern programming languages.
To enable regular expressions, select Use Regular Expressions. Note: You will likely want
to select Match all occurrences while using regular expressions.
To use the Boost library instead of the standard library, select the Use Boost library
option in the PowerToys settings. It enables extended features, like lookbehind , which
are not supported by the standard library.
ノ Expand table
^foo.*bar$ Match text that begins with "foo" and ends with "bar"
ノ Expand table
Settings
Additional options can be configured in the settings, as described below:
ノ Expand table
Setting Description
Hide icon in context menu Hides the PowerRename icon in the context menu
Enable auto-complete for the Automatically suggest terms to use in the search and
search and replace fields replace fields based on prior uses of PowerRename
Maximum number of items The largest number of search and replace suggestions to
display
Show recently used strings When opening PowerRename, populate the search and
replace fields with the last values used
PowerToys Run is a quick launcher for power users that contains additional features
without sacrificing performance. It is open source and modular for additional plugins.
To use PowerToys Run, select Alt + Space and start typing! (Note that this shortcut can
be changed in the settings window.)
) Important
PowerToys must be running in the background and Run must be enabled for this
utility to work.
Features
PowerToys Run features include:
Settings
The following general options are available on the PowerToys Run settings page.
ノ Expand table
Setting Description
Use centralized keyboard hook Try this setting if there are issues with the shortcut
(PowerToys Run might not get focus when triggered from an
elevated window)
Ignore shortcuts in full-screen When in full-screen (F11), PowerToys Run won't be engaged
mode with the shortcut
Input smoothing Add a delay to wait for more input before executing a search
Immediate plugins How many milliseconds a plugin that makes the UI wait
should wait before showing results
Background execution plugins How many milliseconds a plugin that executes in the
background should wait before showing results
Clear the previous query on When opened, previous searches will not be highlighted
opening
Results order tuning Fine tunes the ordering of the displayed results
Selected item weight Use a higher number to get selected results to rise faster
(Default: 5, 0 to disable)
Wait for slower plugin results Selecting this can help preselect the top, more relevant
before selecting top item in result, but at the risk of jumpiness
results
Tab through context buttons When enabled, you can tab through the context buttons
before tabbing to the next result
Generate thumbnails for files Thumbnails will be generated for files in the results list (this
may affect speed and stability)
Preferred monitor position If multiple displays are in use, PowerToys Run can be opened
on:
Setting Description
• Primary display
• Display with mouse cursor
• Display with focused window
Plugin manager
PowerToys Run uses a plugin system to provide different types of results. The settings
page includes a plugin manager that allows you to enable/disable the various available
plugins. By selecting and expanding the sections, you can customize the direct
activation commands used by each plugin. In addition, you can select whether a plugin
appears in global results and set additional plugin options where available.
Direct activation commands
The plugins can be activated with a direct activation command so that PowerToys Run
will only use the targeted plugin. The following table shows the direct activation
commands assigned by default.
Tip
You can change commands to fit your personal needs in the plugin manager.
) Important
Some characters and phrases may conflict with global queries of other plugins if
you use them as activation commands. For example, using ( breaks global
calculation queries starting with an opening parenthesis.
ノ Expand table
Calculator = = 2+2
History !! !! car to find any results that have been selected in the
past, from any enabled plugin, that matches 'car'.
Time and date ) ) time and date shows the current time and date in
different formats.
Plug-in Direct Example
activation
command
Window Walker < < outlook to find all open windows that contain 'outlook' in
their name or the name of their process.
ノ Expand table
Shortcut Action
Ctrl + Shift + U Open the selected application as different user (only applicable to
applications)
Ctrl + Shift + E Open containing folder in File Explorer (only applicable to applications
and files)
Tab Navigate through the search results and context menu buttons
System commands
The Windows System Commands plugin provides a set of system level actions that can
be executed.
Tip
ノ Expand table
Recycle Bin Result: Opens the recycle bin The query Empty Recycle Bin shows the
Context menu: Empties the Recycle result too.
Bin
UEFI Firmware Reboots the computer into UEFI Only available on systems with UEFI
Settings Firmware Settings firmware. Requires administrative
permissions.
IP address * Shows the ip addresses from the The search query has to start with the
network connections of your word IP or the word address .
computer.
MAC address * Shows the mac addresses from the The search query has to start with the
network adapters in your computer. word MAC or the word address .
Program plugin
The Program plugin can open software applications (such as Win32 or packaged
programs). The plugin scans common install locations, like the Start menu and desktops
that you have access to, looking for executable files (.exe) or shortcut files (such as .lnk
or .url). On occasion, a program may not be found by the program plugin scan and you
may want to manually create a shortcut in the directory containing the program you
want to access.
Program parameters
The Program plugin allows for program arguments to be added when opening an
application. The program arguments must follow the expected format as defined by the
program's command line interface.
7 Note
To input valid search queries, the first element after the program name has to be
one of the following possibilities:
Visual Studio Code also supports a set of command line parameters , which can be
used with their corresponding arguments in PowerToys Run to, for instance, view the
difference between files:
If the program plugin's option Include in global result is not selected, include the
activation phrase, . by default, to invoke the plugin's behavior:
Calculator plugin
) Important
Please be aware of the different decimal and thousand delimiters in different locals.
The Calculator plugin respects the number format settings of your system. If you
prefer the English (United States) number format, change the behavior for the
query input and the result output in the plugin manager. If your system's number
format uses the comma ( , ) as the decimal delimiter, you have to write a space
between the number(s) and comma(s) on operations with multiple parameters. The
input has to look like this: min( 1,2 , 3 , 5,7) or min( 1.2 , 3 , 5.7) .
Tip
The Calculator plugin can handle some implied multiplications like 2(3+4) and
(1+2)(3+4) by inserting the multiplication operator where appropriate.
ノ Expand table
Addition a+b
Subtraction a-b
Operation Operator Description
Syntax
Multiplication a*b
Division a/b
Modulo/Remainder a%b
Exponentiation a^b
Ceiling function ceil( x.y ) Rounds a number up to the next larger integer.
Floor function floor( x.y ) Rounds a number down to the next smaller integer.
Maximum max( x, y, z )
Minimum min( x, y, z )
Factorial x!
Sine sin( x )
Cosine cos( x )
Tangent tan( x )
History plugin
The History plugin allows quick access to previously selected results from other plugins.
You can access and remove them using the direct activation command. To remove them
from history, select the Remove this from history context menu item.
The Time and Date plugin respects the date and time format settings of your
system. Please be aware of the different notations in different locals.
) Important
For global queries the first word of the query has to be a complete match.
Examples:
) unix epoch::3/27/2022 10:30:45 AM to convert the given time and date value
) Important
The Unit Converter plugin respects the number format settings of your system.
Please be aware of the different decimal characters and thousands delimiters in
different locals. The names and abbreviations of the units aren't localized yet.
Acceleration
Angle
Area
Duration
Energy
Information technology
Length
Mass
Power
Pressure
Speed
Temperature
Volume
UUIDs
It supports the following GUID versions:
v1 - Time based
v3 - Namespace and name based, using MD5
v4 - Random value
v5 - Namespace and name based, using SHA1
7 Note
For versions 3 and 5 there are some predefined namespaces: DNS, URL, OID and
X500. You can use the following predefined namespaces:
ns:DNS
ns:URL
ns:OID
ns:X500
Examples:
ノ Expand table
Command Result
# guidv3 ns:DNS Generate the GUID version 3 for www.microsoft.com using the
www.microsoft.com DNS namespace.
# uuidv3 ns:DNS The namespace parameter can be any valid GUID, and the name
www.microsoft.com parameter can be any string.
Tip
The guid and uuid keywords are interchangeable and the v is optional. I.e. guid5
and guidv5 are the same.
Hashing
It supports the following hashing algorithms:
MD5
SHA1
SHA256
SHA384
SHA512
Usage:
# md5 abc
Base64
# base64 abc
# base64d SGVsbG8gV29ybGQ=
URL
Usage for encoding an URL:
7 Note
The whole URL including the / and the protocol identifier gets encoded. If you
only like to encode the query part of the URL you should only enter this part.
# uesc:data C%3A%5CProgram%20Files%5CPowerToys%5CPowerToys.exe
# esc:hex z
# uesc:hex %7A
7 Note
Only the first hexadecimal character of your input is converted. The rest of the
input is ignored.
Folder plugin
With the folder plugin you can navigate through your directories.
Search filter
In the Folder plugin you can filter the results by using some special characters.
ノ Expand table
$ control>system>admin to show all settings of the path Control Panel > System
Service plugin
The Service plugin lets you search, start, stop and restart Windows services directly from
the PowerToys Run search screen.
To search for Windows services, enable the plugin, open PowerToys Run and enter the
name of the service. Additionally, you can use the following syntax:
7 Note
Killing the Explorer process is only allowed if each folder window is running in
its own process.
You can only kill elevated processes if you have admin permissions (UAC).
Windows of UWP apps don't know their process until they are searched in
non-minimized state.
2 Warning
If you kill the process of an UWP app window, you kill all instances of the app. All
windows are assigned to the same process.
If the File Explorer settings in Windows are not set to open each window in a separate
process, you will see the following message when searching for open Explorer windows:
You can turn off the message in the PowerToys Run plugin manager options for Window
Walker, or select the message to change the File Explorer settings. On the Folder
options window, select Launch folder windows in a separate process.
Windows Search plugin
With the Windows Search plugin you can search for files and folders that are indexed by
the Windows Search Index service.
Select Enhanced mode to enable indexing across all of the drives on your
Windows machine.
Specify folder paths to exclude.
Select Advanced Search Indexer Settings to set advanced index settings, add or
remove search locations, index encrypted files, etc.
Known issues
For a list of all known issues and suggestions, see the PowerToys product repository
issues on GitHub .
Attribution
Wox
Beta Tadele's Window Walker
Quick Accent is an alternative way to type accented characters, useful when a keyboard
doesn't support that specific accent with a quick key combo. This tool is based on
Damien Leroy's PowerAccent .
In order to use the Quick Accent utility, open PowerToys Settings, select the Quick
Accent page, and turn on the Enable toggle.
How to activate
Activate by holding the key for the character you want to add an accent to, then (while
held down) press the activation key (Space key or Left / Right arrow keys). If you
continue to hold, an overlay to choose the accented character will appear.
For example: If you want "à", press and hold A and press Space .
Character sets
You can limit the available characters by selecting a character set from the settings
menu. Available character sets are:
Catalan
Currency
Croatian
Czech
Danish
Gaeilge
Gàidhlig
Dutch
Greek
Estonian
Finnish
French
German
Hebrew
Hungarian
Icelandic
Italian
Kurdish
Lithuanian
Macedonian
Maori
Norwegian
Pinyin
Polish
Portuguese
Romanian
Slovak
Slovenian
Spanish
Serbian
Swedish
Turkish
Welsh
Settings
From the Settings menu, the following options can be configured:
ノ Expand table
Setting Description
Character set Show only characters that are in the chosen set.
Show the Unicode code and Shows the Unicode code (in hexadecimal) and name of the
name of the currently currently selected character under the selector.
selected character
Start selection from the left Starts the selection from the leftmost character for all activation
keys (including Left/Right arrow).
Excluded apps Add an application's name, or part of the name, one per line (e.g.
adding Notepad will match both Notepad.exe and Notepad++.exe ;
to match only Notepad.exe add the .exe extension).
PowerToys Registry Preview simplifies the process of visualizing and editing complex
Windows Registry files. It can also write changes to the Windows Registry.
Getting started
Enable
To start using Registry Preview, enable it in the PowerToys Settings.
How to activate
Select one or more .reg files in Windows File Explorer. Right-click on the selected file(s)
and select Preview to open Registry Preview. On Windows 11: select Show more
options to expand the list of menu options. Registry Preview can also be opened from
PowerToys Settings.
Note: Currently, there is a 10MB file limit for opening Windows Registry files with
Registry Preview. It will show a message if a file contains invalid content.
How to use
After opening a Windows Registry file, the content is shown. This content can be
updated at any time.
On the other side there is a visual tree representation of the registry keys listed in the
file. This visual tree will be updated on each file content change inside the app.
Select a registry key in the visual tree to see the values of that registry key below it.
Select Reload to reload file content in case the file is changed outside of the Registry
Preview.
Select Write to registry to save the data listed in the Preview to the Windows Registry.
The Windows Registry Editor will ask for confirmation before writing data.
Select Open key to open the Windows Registry Editor with the location of the key you
have highlighted in the treeview as the initial starting point.
Screen ruler allows you to quickly measure pixels on your screen, based on image edge
detection. This was inspired by Pete Blois's Rooler .
How to activate
Use ⊞ Win + Shift + M to activate and select which tool you want to measure with. To
close, use Esc or select ╳ in the toolbar.
How to use
Bounds (dashed square symbol): This is a bounding box. Click and drag with your
mouse. If you hold Shift , the box(es) will stay in place until you cancel the
interaction.
Spacing (╋): Measure horizontal and vertical spacing at the same time. Select the
symbol and move your mouse to your target location.
Horizontal (━): Measure only horizontal spacing. Select the symbol and move your
mouse pointer to your target location.
Vertical (┃): Measure only vertical spacing. Select the symbol and move your
mouse pointer to your target location.
Cancel interaction: Esc , ╳ or mouse click. Upon clicking the primary mouse
button, the measurement is copied to the clipboard.
Tip
Scroll up with the mouse wheel to increase the threshold for pixel difference by 15
units per wheel tick. Effectively the measuring line can become longer. Scroll down
to reverse.
Settings
From the Settings menu, the following options can be configured:
ノ Expand table
Setting Description
Activation shortcut The customizable keyboard command to turn the toolbar on or off.
Capture screen When off, the utility takes a single snapshot of your screen. When this
continuously during is turned on, the utility will attempt real-time detection. Continuous
measuring mode will consume more resources when in use.
Per color channel edge Test if all color channels are within a tolerance distance from each
detection other. Otherwise, check that the sum of all color channels differences is
smaller than the tolerance.
Pixel tolerance for edge A value between 0-255. A higher value will provide a higher variation
detection so it will be more forgiving with things like gradients and shadows.
Draw feet on the cross Adds small, serif-like "feet" for additional visual recognition.
Line color The color for the line that does the measuring.
This guide displays common keyboard shortcuts that use the Windows key.
Getting started
Open the shortcut guide with the shortcut key combination: ⊞ Win + Shift + / (or as
we like to think, ⊞ Win + ? ) or hold down the ⊞ Win for the time as set in the Settings.
An overlay will appear showing keyboard shortcuts that use the Windows key, including:
Keyboard shortcuts using the Windows key ⊞ Win can be used while the guide is
displayed. The result of those shortcuts (active window moved, arrow shortcut behavior
changes etc.) will be displayed in the guide.
Pressing the shortcut key combination again will dismiss the overlay.
Tapping the Windows key will display the Windows Start menu.
) Important
The PowerToys app must be running and Shortcut Guide must be enabled in the
PowerToys settings for this feature to be used.
Settings
These configurations can be edited from the PowerToys Settings:
ノ Expand table
Setting Description
Press duration Time (in milliseconds) to hold down the ⊞ Win key in order to open global
Windows shortcuts or taskbar icon shortcuts
Excluded apps Ignores Shortcut Guide when these apps are in focus. Add an application's
name, or part of the name, one per line (e.g. adding Notepad will match both
Notepad.exe and Notepad++.exe ; to match only Notepad.exe add the .exe
extension).
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
Text Extractor utility
Article • 04/09/2024
Text Extractor enables you to copy text from anywhere on your screen, including inside
images or videos. This code is based on Joe Finney's Text Grab .
How to activate
With the activation shortcut (default: ⊞ Win + Shift + T ), you'll see an overlay on the
screen. Click and hold your primary mouse button and drag to activate your capture.
The text will be saved to your clipboard.
How to deactivate
Capture mode is closed immediately after text in the selected region is recognized and
copied to the clipboard. Close capture mode with Esc at any moment.
) Important
1. The produced text may not be perfect, so you have to do a quick proof read
of the output.
2. This tool uses OCR (Optical Character Recognition) to read text on the screen.
3. The default language used will be based on your Windows system language
> Keyboard settings . OCR language packs are available for installation.
Settings
From the Settings menu, the following options can be configured:
ノ Expand table
Setting Description
Activation shortcut The customizable keyboard command to turn on or off this module.
Supported languages
Text Extractor can only recognize languages that have the OCR language pack installed.
The list can be obtained via PowerShell by running the following commands:
PowerShell
# Please use Windows PowerShell, not PowerShell 7 as these aren't .NET Core
libraries
[Windows.Media.Ocr.OcrEngine]::AvailableRecognizerLanguages
PowerShell
An example output:
PowerShell
Name : Language.OCR~~~el-GR~0.0.1.0
State : NotPresent
Name : Language.OCR~~~en-GB~0.0.1.0
State : NotPresent
Name : Language.OCR~~~en-US~0.0.1.0
State : Installed
Name : Language.OCR~~~es-ES~0.0.1.0
State : NotPresent
Name : Language.OCR~~~es-MX~0.0.1.0
State : NotPresent
PowerShell
PowerShell
PowerShell
PowerShell
Troubleshooting
This section will list possible errors and solutions.
If an OCR pack is supported and installed, but still is not available and your system drive
X: is different than "C:", then copy X:/Windows/OCR folder to C:/Windows/OCR to fix the
issue.
7 Note
VCM is moving into legacy mode. Please find more about what this means in our
dedicated issue .
Quickly mute your microphone (audio) and turn off your camera (video) with a single
keystroke while on a conference call, regardless of what application has focus on your
computer.
Getting started
The default shortcuts to use Video Conference Mute are:
⊞ Win + Shift + Q to toggle both audio and video at the same time
⊞ Win + Shift + A to toggle microphone
⊞ Win + Shift + I to toggle microphone until key release
⊞ Win + Shift + O to toggle camera
When using the microphone and/or camera toggle shortcut keys, you'll see a small
toolbar letting you know whether your microphone and camera are set to on, off, or not
in use. Set the position of this toolbar in PowerToys settings.
To use this module, it must be selected as the source in the apps that are using camera
and/or microphone. Go to the settings and select PowerToys VCM.
Settings
The settings provide the following options:
ノ Expand table
Setting Description
Shortcuts Change the shortcut key used to mute your microphone, camera,
or both combined.
Selected microphone Select the microphone on your machine that this utility will use.
Push to reverse If enabled, allows both push to talk and push to mute, depending
on microphone state.
Selected camera Select the camera on your machine that this utility will use.
Camera overlay image Select an image to that will be used as a placeholder when your
camera is turned off. By default, a black screen will appear when
your camera is turned off with this utility.
Toolbar Set the position where the Microphone On, Camera On toolbar
displays when toggled (default: top right corner).
Show toolbar on Select whether you prefer the toolbar to be displayed on the main
monitor only (default) or on all monitors.
Setting Description
Audio: PowerToys uses the global microphone mute API in Windows. Apps should
recover when this is toggled on and off.
Video: PowerToys has a virtual driver for the camera. The video is routed through
the driver and then to the application. Selecting the Video Conference Mute
shortcut key stops video from streaming, but the application still thinks it is
receiving video. The video is just replaced with black or the image placeholder
you've saved in the settings.
Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment --
including most command-line tools, utilities, and applications -- directly on Windows,
unmodified, without the overhead of a traditional virtual machine or dual-boot setup.
Install WSL
Learn more
What is the Windows Subsystem for Linux (WSL)?
What's new with WSL 2?
Comparing WSL 1 and WSL 2
Frequently Asked Questions
Get started
Install WSL
Install Linux on Windows Server
Manual install steps
Best practices for setting up a WSL development environment
Provide feedback
GitHub issue tracker: WSL
GitHub issue tracker: WSL documentation
Related videos
WSL BASICS
1. What is the Windows Subsystem for Linux (WSL)? | One Dev Question (0:40)
2. I'm a Windows developer. Why should I use WSL? | One Dev Question (0:58)
3. I'm a Linux developer. Why should I use WSL? | One Dev Question (1:04)
4. What is Linux? | One Dev Question (1:31)
5. What is a Linux distro? | One Dev Question (1:04)
6. How is WSL different than a virtual machine or dual booting? | One Dev
Question
7. Why was the Windows Subsystem for Linux created? | One Dev Question (1:14)
8. How do I access files on my computer in WSL? | One Dev Question (1:41)
9. How is WSL integrated with Windows? | One Dev Question (1:34)
10. How do I configure a WSL distro to launch in the home directory in Terminal? |
One Dev Question (0:47)
11. Can I use WSL for scripting? | One Dev Question (1:04)
12. Why would I want to use Linux tools on Windows? | One Dev Question (1:20)
13. In WSL, can I use distros other than the ones in the Microsoft Store? | One Dev
Question (1:03)
WSL DEMOS
1. WSL2: Code faster on the Windows Subsystem for Linux! | Tabs vs Spaces (13:42)
2. WSL: Run Linux GUI Apps | Tabs vs Spaces (17:16)
3. WSL 2: Connect USB devices | Tabs vs Spaces (10:08)
4. GPU Accelerated Machine Learning with WSL 2 | Tabs vs Spaces (16:28)
5. Visual Studio Code: Remote Dev with SSH, VMs, and WSL | Tabs vs Spaces (29:33)
6. Windows Dev Tool Updates: WSL, Terminal, Package Manager, and more | Tabs
vs Spaces (20:46)
7. Build Node.JS apps with WSL | Highlight (3:15)
8. New memory reclaim feature in WSL 2 | Demo (6:01)
9. Web development on Windows (in 2019) | Demo (10:39)
Windows Terminal is a modern host application for the command-line shells you already
love, like Command Prompt, PowerShell, and bash (via Windows Subsystem for Linux
(WSL)). Its main features include multiple tabs, panes, Unicode and UTF-8 character
support, a GPU accelerated text rendering engine, and the ability to create your own
themes and customize text, colors, backgrounds, and shortcuts.
https://www.microsoft.com/en-us/videoplayer/embed/RWHAdS?postJsllMsg=true
7 Note
For more general info, check out Scott Hanselman's article: What's the difference
between a console, a terminal, and a shell? or Rich Turner's video What is a
command-line shell? .
For example, the default shortcut to copy text from the command line is Ctrl+Shift+C .
You can change this to Ctrl+1 or whatever you prefer. To open a new tab, the default
shortcut is Ctrl+Shift+T , but maybe you want to change this to Ctrl+2 . The default
shortcut to flip between the tabs you have open is Ctrl+Tab , this could be changed to
Ctrl+- and used to create a new tab instead.
For example, to open Windows Terminal from PowerShell with three panes, with the left
pane running a Command Prompt profile and the right pane split between your
PowerShell and your default profile running WSL, enter:
PowerShell
Learn how to set up command-line arguments on the Command line arguments page.
Sudo for Windows is a new way for users to run elevated commands (as an
administrator) directly from an unelevated console session on Windows.
Read the announcement , which includes a demo video and deep-dive into how Sudo
for Windows works.
Prerequisites
You must be running Windows 11 Insider Preview Build 26052 or higher to use the Sudo
for Windows command. (Check for Windows updates). Join Windows Insider Program .
7 Note
Sudo for Windows is not yet available for Windows 10, but may be in the future.
2 Warning
Sudo for Windows can be used as a potential escalation of privilege vector when
enabled in certain configurations. You should make sure to be aware of the security
considerations when enabling the sudo command on your machine.
Input closed ( disableInput ): The disableInput configuration option will run the
elevated process in the current window, but with the input handle closed. This
means that the elevated process will not be able to receive input from the current
console window. This is useful for scenarios where you want to run a command as
an administrator, but do not want to allow the command to receive input from the
current console window. This configuration option provides some of the
convenience of the inline configuration option while mitigating some of the
associated security risks.
Inline ( normal ): The normal configuration option is most similar to how sudo
behaves on other operating systems. This configuration will run the elevated
process in the current window and the process will be able to receive input from
the current console session. This is useful for scenarios where you want to run a
command as an administrator and want to allow the command to receive input
from the current console window. This configuration option provides the most
convenience, but you should only choose this option if you are familiar with the
associated security risks.
You can select among these configurations from the Settings > For Developers menu
or change the configuration programmatically, in an elevated command line (admin
console), using:
Because sudo elevates the targeted process to run with administrator-level permission,
a prompt will open asking you to verify that you want to continue.
Security Considerations
There are risks associated with running sudo in the Input closed ( inputClosed ) or Inline
( normal ) configurations. It is possible for malicious processes to attempt to drive the
elevated process using the connection established by the unelevated sudo.exe and the
elevated sudo.exe process.
The inputClosed configuration option mitigates risk by closing the input handle.
Disconnecting the input handle from the current console window means that
unelevated processes cannot send input to the elevated process.
The inline configuration option runs the elevated process in the current window and
the process is able to receive input from the current console session. An unelevated
process can send input to the elevated process within the same console windows or get
information from the output in the current windows in this configuration.
FAQ
The sudo command offers a way to quickly elevate a command as administrator from
your current unelevated command line context and is familiar to some users coming
from other operating systems. The runas command offers a way to run programs as any
user, including administrator if you so choose. At this point in time, the sudo command
on Windows does not support running programs as other users. Other key differences
between sudo and runas include:
runas allows you to run programs as other users, including but not limited to as
administrator. This functionality is on the roadmap for the sudo command, but
does not yet exist.
sudo allows you to quickly elevate a process (as administrator):
sudo can only be elevated via the User Account Control (UAC) security feature
You should consider your particular use-case and plan to use the command that best
meets your needs. You should also consider the security implications of running sudo in
the inputClosed and normal modes. The default forceNewWindow configuration option is
recommended unless you are familiar and comfortable with the risks associated with the
other sudo configurations.
Additional functionality
If you’re looking for additional functionality that Sudo for Windows does not provide,
check out Gerardo Grignoli’s gsudo which has a number of additional features and
configuration options or check out other solutions from the community.
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
Guide for changing your dev
environment from Mac to Windows
Article • 10/24/2022
The following tips and control equivalents should help you in your transition between a
Mac and Windows (or WSL/Linux) development environment.
For app development, the nearest equivalent to Xcode would be Visual Studio . There
is also a version of Visual Studio for Mac , if you ever feel the need to go back. For
cross-platform source code editing (and a huge number of plug-ins) Visual Studio
Code is the most popular choice.
Keyboard shortcuts
Tip
You can use PowerToys Keyboard Manager to map Windows shortcuts to the
shortcuts you use on a Mac.
ノ Expand table
Select more than one item in a list Command, then click each Control, then click each
(noncontiguous) item item
Trackpad shortcuts
7 Note
ノ Expand table
Zoom Two finger pinch in and Two finger pinch in and out
out
Swipe back and forward between Two finger sideways Two finger sideways swipe
views swipe
Switch virtual workspaces Four fingers sideways Four fingers sideways swipe
swipe
Display currently open apps Four fingers upward Three fingers upward swipe
swipe
Operation Mac Windows
Open Cortana / Action center Two finger slide from Three finger tap
right
Show launchpad / start an app Pinch with four fingers Tap with four fingers
Windows shells
Windows has two primary command-line shells:
Mac and Linux BASH shell users: PowerShell also supports many command-aliases
that you are already familiar with. For example:
Some commands and arguments are different in PowerShell vs. BASH. Learn more
by entering: get-help in PowerShell or checkout the compatibility aliases in the
docs.
To run PowerShell as an Administrator, enter "PowerShell" in your Windows start
menu, then select "Run as Administrator."
2. Windows Command Line (Cmd): Windows still ships the traditional Command
Prompt (and Console – see below), providing compatibility with current and legacy
MS-DOS-compatible commands and batch files. Cmd is useful when running
existing/older batch files or command-line operations, but in general, users are
recommended to learn and use PowerShell since Cmd is now in maintenance, and
will not be receiving any improvements or new features in the future.
Linux shells
Windows Subsystem for Linux (WSL) can now be installed to support running a Linux
shell within Windows. This means that you can run bash, with whichever specific Linux
distribution you choose, integrated right inside Windows. Using WSL will provide the
kind of environment most familiar to Mac users. For example, you will ls to list the files
in a current directory, not dir as you would with the traditional Windows Cmd Shell. To
learn about installing and using WSL, see the Windows Subsystem for Linux Installation
Guide. Linux distributions that can be installed on Windows with WSL include:
Just to name a few. Find more in the WSL install docs and install them directly from the
Microsoft Store .
Windows Terminals
In addition to many 3rd party offerings, Microsoft provides two "terminals" – GUI
applications that provide access to command-line shells and applications.
2. Console: On Mac and Linux, users usually start their preferred terminal application
which then creates and connects to the user's default shell (e.g. BASH).
However, due to a quirk of history, Windows users traditionally start their shell, and
Windows automatically starts and connects a GUI Console app.
While one can still launch shells directly and use the legacy Windows Console, it's
highly recommended that users instead install and use Windows Terminal to
experience the best, fastest, most productive command-line experience.
The following tips and control equivalents should help you in your transition between a
Mac and Windows (or WSL/Linux) development environment.
For app development, the nearest equivalent to Xcode would be Visual Studio . There
is also a version of Visual Studio for Mac , if you ever feel the need to go back. For
cross-platform source code editing (and a huge number of plug-ins) Visual Studio
Code is the most popular choice.
Keyboard shortcuts
Tip
You can use PowerToys Keyboard Manager to map Windows shortcuts to the
shortcuts you use on a Mac.
ノ Expand table
Select more than one item in a list Command, then click each Control, then click each
(noncontiguous) item item
Trackpad shortcuts
7 Note
ノ Expand table
Zoom Two finger pinch in and Two finger pinch in and out
out
Swipe back and forward between Two finger sideways Two finger sideways swipe
views swipe
Switch virtual workspaces Four fingers sideways Four fingers sideways swipe
swipe
Display currently open apps Four fingers upward Three fingers upward swipe
swipe
Operation Mac Windows
Open Cortana / Action center Two finger slide from Three finger tap
right
Show launchpad / start an app Pinch with four fingers Tap with four fingers
Windows shells
Windows has two primary command-line shells:
Mac and Linux BASH shell users: PowerShell also supports many command-aliases
that you are already familiar with. For example:
Some commands and arguments are different in PowerShell vs. BASH. Learn more
by entering: get-help in PowerShell or checkout the compatibility aliases in the
docs.
To run PowerShell as an Administrator, enter "PowerShell" in your Windows start
menu, then select "Run as Administrator."
2. Windows Command Line (Cmd): Windows still ships the traditional Command
Prompt (and Console – see below), providing compatibility with current and legacy
MS-DOS-compatible commands and batch files. Cmd is useful when running
existing/older batch files or command-line operations, but in general, users are
recommended to learn and use PowerShell since Cmd is now in maintenance, and
will not be receiving any improvements or new features in the future.
Linux shells
Windows Subsystem for Linux (WSL) can now be installed to support running a Linux
shell within Windows. This means that you can run bash, with whichever specific Linux
distribution you choose, integrated right inside Windows. Using WSL will provide the
kind of environment most familiar to Mac users. For example, you will ls to list the files
in a current directory, not dir as you would with the traditional Windows Cmd Shell. To
learn about installing and using WSL, see the Windows Subsystem for Linux Installation
Guide. Linux distributions that can be installed on Windows with WSL include:
Just to name a few. Find more in the WSL install docs and install them directly from the
Microsoft Store .
Windows Terminals
In addition to many 3rd party offerings, Microsoft provides two "terminals" – GUI
applications that provide access to command-line shells and applications.
2. Console: On Mac and Linux, users usually start their preferred terminal application
which then creates and connects to the user's default shell (e.g. BASH).
However, due to a quirk of history, Windows users traditionally start their shell, and
Windows automatically starts and connects a GUI Console app.
While one can still launch shells directly and use the legacy Windows Console, it's
highly recommended that users instead install and use Windows Terminal to
experience the best, fastest, most productive command-line experience.
This guide will help you get started using JavaScript frameworks on Windows, including
Node.js, React.js, Vue.js, Next.js, Nuxt.js, or Gatsby.
Node.js overview
Learn about what you can do with Node.js and how to set up a Node.js development
environment.
Install on Windows
Install on WSL
Try a beginner-level tutorial
React overview
Learn about what you can do with React and how to set up a React development
environment.
Install on Windows for building web apps
Install on WSL for building web apps
Install on Windows for building desktop apps
Install on Windows for building Android mobile apps
Try a beginner-level tutorial
Vue.js overview
Learn about what you can do with Vue.js and how to set up a Vue.js development
environment.
Install on Windows
Install on WSL
Try a beginner-level tutorial
Single-page apps (SPAs): These are web apps that work inside a browser and don't
need to reload a page every time you use it to get new data. Some example SPAs
include social networking apps, email or map apps, online text or drawing tools,
etc.
Real-time apps (RTAs): These are web apps that enable users to receive
information as soon as it's published by an author, rather than requiring that the
user (or software) check a source periodically for updates. Some example RTAs
include instant messaging apps or chat rooms, online multiplayer games that can
be played in the browser, online collaboration docs, community storage, video
conference apps, etc.
Data streaming apps: These are apps (or services) that send data/content as it
arrives (or is created) while keeping the connection open to continue downloading
further data, content, or components as needed. Some examples include video-
and audio-streaming apps.
REST APIs: These are interfaces that provide data for someone else's web app to
interact with. For example, a Calendar API service could provide dates and times
for a concert venue that could be used by someone else's local events website.
Server-side rendered apps (SSRs): These web apps can run on both the client (in
your browser / the front-end) and the server (the back-end) allowing pages that
are dynamic to display (generate HTML for) whatever content is known and quickly
grab content that is not known as it's available. These are often referred to as
"isomorphic" or "universal" applications. SSRs utilize SPA methods in that they
don't need to reload every time you use it. SSRs, however, offer a few benefits that
may or may not be important to you, like making content on your site appear in
Google search results and providing a preview image when links to your app are
shared on social media like X or Facebook. The potential drawback being that they
require a Node.js server constantly running. In terms of examples, a social
networking app that supports events that users will want to appear in search
results and social media may benefit from SSR, while an email app may be fine as
an SPA. You can also run server-rendered no-SPA apps, which may be something
like a WordPress blog. As you can see, things can get complicated, you just need
to decide what's important.
Command line tools: These allow you to automate repetitive tasks and then
distribute your tool across the vast Node.js ecosystem. An example of a command
line tool is cURL, which stand for client URL and is used to download content from
an internet URL. cURL is often used to install things like Node.js or, in our case, a
Node.js version manager.
Hardware programming: While not quite as popular as web apps, Node.js is
growing in popularity for IoT uses, such as collecting data from sensors, beacons,
transmitters, motors, or anything that generates large amounts of data. Node.js
can enable data collection, analyzing that data, communicating back and forth
between a device and server, and taking action based on the analysis. NPM
contains more than 80 packages for Arduino controllers, raspberry pi, Intel IoT
Edison, various sensors, and Bluetooth devices.
Next steps
Install NodeJS on Windows
Install NodeJS on WSL
Build JavaScript applications with Node.js learning path
If you prefer using Node.js in a Linux environment, find performance speed and system
call compatibility important, want to run Docker containers that leverage Linux
workspaces and avoid having to maintain both Linux and Windows build scripts, or just
prefer using a Bash command line, then you want to install Node.js on the Windows
Subsystem for Linux (more specifically, WSL 2).
Using Windows Subsystem for Linux (WSL), might also enable you to install your
preferred Linux distribution (Ubuntu is our default) so that you can have consistency
between your development environment (where you write code) and production
environment (the server where your code is deployed).
7 Note
If you are new to developing with Node.js and want to get up and running quickly
so that you can learn, install Node.js on Windows. This recommendation also
applies if you plan to use a Windows Server production environment.
Install WSL 2
WSL 2 is the most recent version available for Windows and we recommend it for
professional Node.js development workflows. To enable and install WSL 2, follow the
steps in the WSL install documentation. These steps will include choosing a Linux
distribution (for example, Ubuntu).
Once you have installed WSL 2 and a Linux distribution, open the Linux distribution (it
can be found in your Windows start menu) and check the version and codename using
the command: lsb_release -dc .
Install Windows Terminal using the Microsoft Store : By installing via the store, updates
are handled automatically.
) Important
For the most current information on installing NVM, see Installing and Updating in the
NVM repo on GitHub .
2. Install cURL (a tool used for downloading content from the internet in the
command-line) with: sudo apt-get install curl
Installing a newer version of NVM using cURL will replace the older one,
leaving the version of Node you've used NVM to install intact. For more
information, see the GitHub project page for the latest release information
on NVM .
4. To verify installation, enter: command -v nvm ...this should return 'nvm', if you receive
'command not found' or no response at all, close your current terminal, reopen it,
and try again. Learn more in the nvm github repo .
5. List which versions of Node are currently installed (should be none at this point):
nvm ls
6. Install both the current and stable LTS versions of Node.js. In a later step, you'll
learn how to switch between active versions of Node.js with an nvm command.
Install the current stable LTS release of Node.js (recommended for production
applications): nvm install --lts
Install the current release of Node.js (for testing latest Node.js features and
improvements, but more likely to have issues): nvm install node
7. List what versions of Node are installed: nvm ls ...now you should see the two
versions that you just installed listed.
8. Verify that Node.js is installed and the currently default version with: node --
version . Then verify that you have npm as well, with: npm --version (You can also
use which node or which npm to see the path used for the default versions).
9. To change the version of Node.js you would like to use for a project, create a new
project directory mkdir NodeTest , and enter the directory cd NodeTest , then enter
nvm use node to switch to the Current version, or nvm use --lts to switch to the
LTS version. You can also use the specific number for any additional versions you've
installed, like nvm use v8.2.1 . (To list all of the versions of Node.js available, use
the command: nvm ls-remote ).
If you are using NVM to install Node.js and NPM, you should not need to use the SUDO
command to install new packages.
7 Note
This “remote” scenario is a bit different than you may be accustomed to. WSL
supports an actual Linux distribution where your project code is running, separately
from your Windows operating system, but still on your local machine. The Remote-
WSL extension connects with your Linux subsystem as if it were a remote server,
though it’s not running in the cloud… it’s still running on your local machine in the
WSL environment that you enabled to run alongside Windows.
Other code editors, like IntelliJ, Sublime Text, Brackets, etc. will also work with a WSL 2
Node.js development environment, but may not have the same sort of remote features
that VS Code offers. These code editors may run into trouble accessing the WSL shared
network location (\wsl$\Ubuntu\home) and will try to build your Linux files using
Windows tools, which likely not what you want. The Remote-WSL Extension in VS Code
handles this compatibility for you, with other IDEs you may need to set up an X server.
Support for running GUI apps in WSL (like a code editor IDE) is coming soon.
Terminal-based text editors (vim, emacs, nano) are also helpful for making quick
changes from right inside your console. The article, Emacs, Nano, or Vim: Choose your
Terminal-Based Text Editor Wisely does a nice job explaining some differences and a
bit about how to use each.
2. Install the Remote - WSL Extension on VS Code. This allows you to use WSL as
your integrated development environment and will handle compatibility and
pathing for you. Learn more .
) Important
If you already have VS Code installed, you need to ensure that you have the 1.35
May release or later in order to install the Remote - WSL Extension . We do not
recommend using WSL in VS Code without the Remote-WSL extension as you will
lose support for auto-complete, debugging, linting, etc. Fun fact: This WSL
extension is installed in $HOME/.vscode-server/extensions.
The Extensions window is now divided into three sections (because you installed
the Remote-WSL extension).
"Local - Installed": The extensions installed for use with your Windows
operating system.
"WSL:Ubuntu-18.04-Installed": The extensions installed for use with your
Ubuntu operating system (WSL).
"Recommended": Extensions recommended by VS Code based on the file
types in your current project.
2. In the search box at the top of the Extensions window, enter: Node Extension Pack
(or the name of whatever extension you are looking for). The extension will be
installed for either your Local or WSL instances of VS Code depending on where
you have the current project opened. You can tell by selecting the remote link in
the bottom-left corner of your VS Code window (in green). It will either give you
the option to open or close a remote connection. Install your Node.js extensions in
the "WSL:Ubuntu-18.04" environment.
JavaScript Debugger : Once you finish developing on the server side with
Node.js, you'll need to develop and test the client side. This extension is a DAP-
based JavaScript debugger. It debugs Node.js, Chrome, Edge, WebView2, VS Code
extensions, and more.
Keymaps from other editors : These extensions can help your environment feel
right at home if you're transitioning from another text editor (like Atom, Sublime,
Vim, eMacs, Notepad++, etc).
Settings Sync : Enables you to synchronize your VS Code settings across different
installations using GitHub. If you work on different machines, this helps keep your
environment consistent across them.
If you are new to developing with Node.js and want to get up and running quickly so
that you can learn, follow the steps below to install Node.js directly on Windows.
7 Note
If you are using Node.js professionally, find performance speed and system call
compatibility important, want to run Docker containers that leverage Linux
workspaces and avoid having to maintain both Linux and Windows build scripts, or
just prefer using a Bash command line, then install Node.js on Windows
Subsystem for Linux (more specifically, WSL 2).
) Important
2 Warning
NVM is designed to be installed per-user, and invoked per-shell. It is not designed
for shared developer boxes or build servers with multiple build agents. NVM works
by using a symbolic link. Using nvm in shared scenarios creates a problem because
that link points to a user's app data folder -- so if user x runs nvm use lts , the link
will point node for the entire box to their app data folder. If user y runs node or
npm, they will be directed to run files under x's user account and in the case of npm
-g , they will be modifying x's files, which by default is not allowed. So nvm is only
prescribed for one developer box. This goes for build servers too. If two build
agents are on the same vm/box, they can compete and cause odd behavior in the
builds.
3. Once downloaded, open the zip file, then open the nvm-setup.exe file.
4. The Setup-NVM-for-Windows installation wizard will walk you through the setup
steps, including choosing the directory where both nvm-windows and Node.js will
be installed.
5. Once the installation is complete. Open PowerShell (recommend opening with
elevated Admin permissions) and try using windows-nvm to list which versions of
Node are currently installed (should be none at this point): nvm ls
6. Install the current release of Node.js (for testing the newest feature improvements,
but more likely to have issues than the LTS version): nvm install latest
7. Install the latest stable LTS release of Node.js (recommended) by first looking up
what the current LTS version number is with: nvm list available , then installing
the LTS version number with: nvm install <version> (replacing <version> with the
number, ie: nvm install 12.14.0 ).
8. List what versions of Node are installed: nvm ls ...now you should see the two
versions that you just installed listed.
9. After installing the Node.js version numbers you need, select the version that you
would like to use by entering: nvm use <version> (replacing <version> with the
number, ie: nvm use 12.9.0 ).
10. To change the version of Node.js you would like to use for a project, create a new
project directory mkdir NodeTest , and enter the directory cd NodeTest , then enter
nvm use <version> replacing <version> with the version number you'd like to use
(ie v10.16.3`).
11. Verify which version of npm is installed with: npm --version , this version number
will automatically change to whichever npm version is associated with your current
version of Node.js.
nvs (Node Version Switcher) is a cross-platform nvm alternative with the ability to
integrate with VS Code .
Volta is a new version manager from the LinkedIn team that claims improved
speed and cross-platform support.
To install Volta as your version manager (rather than windows-nvm), go to the Windows
Installation section of their Getting Started guide , then download and run their
Windows installer, following the setup instructions.
) Important
You must ensure that Developer Mode is enabled on your Windows machine
before installing Volta.
To learn more about using Volta to install multiple versions of Node.js on Windows, see
the Volta Docs .
Install Visual Studio Code
We recommend you install Visual Studio Code for developing with Node.js on
Windows. For help, see Node.js tutorial in Visual Studio Code .
IntelliJ IDEA
Sublime Text
Atom
Brackets
Notepad++
Install Git
If you plan to collaborate with others, or host your project on an open-source site (like
GitHub), VS Code supports version control with Git . The Source Control tab in VS
Code tracks all of your changes and has common Git commands (add, commit, push,
pull) built right into the UI. You first need to install Git to power the Source Control
panel.
1. Download and install Git for Windows from the git-scm website .
2. An Install Wizard is included that will ask you a series of questions about settings
for your Git installation. We recommend using all of the default settings, unless
you have a specific reason for changing something.
3. If you've never worked with Git before, GitHub Guides can help you get started.
7 Note
If you are in the (somewhat rare) situation of needing to host a Node.js app on a
Windows server, the most common scenario seems to be using a reverse proxy .
There are two ways to do this: 1) using iisnode or directly . We do not maintain
these resources and recommend using Linux servers to host your Node.js apps.
Tutorial: Node.js for Beginners
Article • 02/09/2022
If you're brand new to using Node.js, this guide will help you to get started with some
basics.
Prerequisites
Installing on Node.js on Windows or on Windows Subsystem for Linux
1. Open your command line and create a new directory: mkdir HelloNode , then enter
the directory: cd HelloNode
2. Create a JavaScript file named "app.js" with a variable named "msg" inside: echo
var msg > app.js
3. Open the directory and your app.js file in VS Code using the command: code .
4. Add a simple string variable ("Hello World"), then send the contents of the string
to your console by entering this in your "app.js" file:
JavaScript
5. To run your "app.js" file with Node.js. Open your terminal right inside VS Code by
selecting View > Terminal (or select Ctrl+`, using the backtick character). If you
need to change the default terminal, select the dropdown menu and choose Select
Default Shell.
6. In the terminal, enter: node app.js . You should see the output: "Hello World".
7 Note
Notice that when you type console in your 'app.js' file, VS Code displays supported
options related to the console object for you to choose from using IntelliSense.
Try experimenting with Intellisense using other JavaScript objects .
1. Open your command line (Command Prompt, Powershell, or whatever you prefer).
2. Create a new project folder: mkdir ExpressProjects and enter that directory: cd
ExpressProjects
7 Note
We are using the npx command here to execute the Express.js Node package
without actually installing it (or by temporarily installing it depending on how
you want to think of it). If you try to use the express command or check the
version of Express installed using: express --version , you will receive a
response that Express cannot be found. If you want to globally install Express
to use over and over again, use: npm install -g express-generator . You can
view a list of the packages that have been installed by npm using npm list .
They'll be listed by depth (the number of nested directories deep). Packages
that you installed will be at depth 0. That package's dependencies will be at
depth 1, further dependencies at depth 2, and so on. To learn more, see
Difference between npx and npm? on StackOverflow.
4. Examine the files and folders that Express included by opening the project in VS
Code, with: code .
The files that Express generates will create a web app that uses an architecture that
can appear a little overwhelming at first. You'll see in your VS Code Explorer
window (Ctrl+Shift+E to view) that the following files and folders have been
generated:
bin . Contains the executable file that starts your app. It fires up a server (on
stylesheets, font files, images, and any other assets that people need when
they connect to your website.
routes . Contains all the route handlers for the application. Two files,
to look here for a matching view when the render method is called. The
default template engine is Jade, but Jade has been deprecated in favor of
Pug, so we used the --view flag to change the view (template) engine. You
can see the --view flag options, and others, by using express --help .
app.js . The starting point of your app. It loads everything and begins serving
user requests. It's basically the glue that holds all the parts together.
package.json . Contains the project description, scripts manager, and app
manifest. Its main purpose is to track your app's dependencies and their
respective versions.
5. You now need to install the dependencies that Express uses in order to build and
run your HelloWorld Express app (the packages used for tasks like running the
server, as defined in the package.json file). Inside VS Code, open your terminal by
selecting View > Terminal (or select Ctrl+`, using the backtick character), be sure
that you're still in the 'HelloWorld' project directory. Install the Express package
dependencies with:
Bash
npm install
6. At this point you have the framework set up for a multiple-page web app that has
access to a large variety of APIs and HTTP utility methods and middleware, making
it easier to create a robust API. Start the Express app on a virtual server by
entering:
Bash
npx cross-env DEBUG=HelloWorld:* npm start
Tip
The DEBUG=myapp:* part of the command above means you are telling Node.js
that you want to turn on logging for debugging purposes. Remember to
replace 'myapp' with your app name. You can find your app name in the
package.json file under the "name" property. Using npx cross-env sets the
DEBUG environment variable in any terminal, but you can also set it with your
terminal specific way. The npm start command is telling npm to run the
scripts in your package.json file.
7. You can now view the running app by opening a web browser and going to:
localhost:3000
8. Now that your HelloWorld Express app is running locally in your browser, try
making a change by opening the 'views' folder in your project directory and
selecting the 'index.pug' file. Once open, change h1= title to h1= "Hello World!"
and selecting Save (Ctrl+S). View your change by refreshing the localhost:3000
URL on your web browser.
ノ Expand table
gm, sharp Image manipulation, including editing, resizing, compression, and so on,
directly in your JavaScript code
imagemin, Minification
UglifyJS2
winston Logging
Let's use the built-in OS module to get some information about your computer's
operating system:
1. In your command line, open the Node.js CLI. You'll see the > prompt letting you
know you're using Node.js after entering: node
2. To identify the operating system you are currently using (which should return a
response letting you know that you're on Windows), enter: os.platform()
Tip
You can use the Node.js OS module to do things like check the platform and
return a platform-specific variable: Win32/.bat for Windows development,
darwin/.sh for Mac/unix, Linux, SunOS, and so on (for example, var isWin =
process.platform === "win32"; ).
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
React overview
Article • 03/18/2024
React components are typically written in JavaScript and JSX (JavaScript XML) which is a
JavaScript extension that looks like a lot like HTML, but has some syntax features that
make it easier to do common tasks like registering event handlers for UI elements. A
React component implements the render method, which returns the JSX representing
the component's UI. In a web app, the JSX code returned by the component is
translated into browser-compliant HTML rendered in the browser.
Basic web apps: If you are new to React and primarily interested in learning about
building a basic web app with React, we recommend that you install create-react-
app directly on Windows. If you're planning to create a web app that will be
deployed for production, you may want to consider installing create-react-app on
Windows Subsystem for Linux (WSL), for better performance speed, system call
compatibility, and alignment between your local development environment and
deployment environment (which is often a Linux server).
Single-Page Apps (SPAs): These are websites that interact with the user by
dynamically rewriting the current web page with new data from a server, rather
than the browser default of loading entire new pages. If you want to build a static
content-oriented SPA website, we recommend installing Gatsby on WSL. If you
want to build a server-rendered SPA website with a Node.js backend, we
recommend installing Next.js on WSL. (Though Next.js now also offers static file
serving ).
Native desktop apps: React Native for Windows + macOS enables you to build
native desktop applications with JavaScript that run across various types of
desktop PCs, laptops, tablets, Xbox, and Mixed Reality devices. It supports both the
Windows SDK and macOS SDK .
Native mobile apps: React Native is a cross-platform way to create Android and
iOS apps with JavaScript that render to native platform UI code. There are two
main ways to install React Native -- the Expo CLI and the React Native CLI. There's
a good comparison of the two on StackOverflow . Expo has a client app for iOS
and Android mobile devices for running and testing your apps. For instructions on
developing an Android app using Windows, React Native, and the Expo CLI see
React Native for Android development on Windows.
Installation options
There are several different ways to install React along with an integrated toolchain that
best works for your use-case scenario. Here are a few of the most popular.
React tools
While writing a simple React component in a plain text editor is a good introduction to
React, code generated this way is bulky, difficult to maintain and deploy, and slow. There
are some common tasks production apps will need to perform. These tasks are handled
by other JavaScript frameworks that are taken by the app as a dependency. These tasks
include:
Compilation - JSX is the language commonly used for React apps, but browsers
can't process this syntax directly. Instead, the code needs to be compiled into
standard JavaScript syntax and customized for different browsers. Babel is an
example of a compiler that supports JSX.
Bundling - Since performance is key for modern web apps, it's important that an
app's JavaScript includes only the needed code for the app and combined into as
few files as possible. A bundler, such as webpack performs this task for you.
Package management - Package managers make it easy to include the
functionality of third-party packages in your app, including updating them and
managing dependencies. Commonly used package managers include Yarn and
npm .
Together, the suite of frameworks that help you create, build, and deploy your app are
called a toolchain. An easy to setup development enviornment for react that uses this
toolchain is Vite which generates a simple one-page app for you. The only setup
required to use Vite is Node.js.
Core components - Components that are developed and supported as part of the
React Native framework.
Community components - Components that are developed and maintained by the
community.
Native components - Components that you author yourself, using platform-native
code, and register to be accessible from React Native.
The React Native Directory provides a list of component libraries that can be filtered
by target platform.
The React learning path contains online course modules to help you get started
with the basics.
Build a single-page app (SPA) that runs in the browser (like this sample web app
that retrieves calendar info for a user with the Microsoft Graph API)
Build a server-rendered app with Next.js or a static-site-generated app with Gatsby
Create a user interface (UI) for a native app that runs on Windows, Android, and
iOS devices (checkout these native Windows app samples or this sample
native app that retrieves calendar info for a user with the Microsoft Graph API)
Develop an app for Surface Duo dual-screen device
Create a web app or native app using Fluent UI React components
Build a React app with TypeScript
Additional resources
The official React docs offers all of the latest, up-to-date information on React
Microsoft Edge Add-ons for React Developer Tools : Adds two tabs to your
Microsoft Edge dev tools to help with your React development: Components and
Profiler.
This guide will walk through installing React on a Linux distribution (ie. Ubuntu) running
on the Windows Subsystem for Linux (WSL) using the vite frontend tooling.
We recommend following these instructions if you are creating a single-page app (SPA)
that you would like to use Bash commands or tools with and/or plan to deploy to a
Linux server or use Docker containers. If you are brand new to React and just interested
in learning, you may want to consider installing with vite directly on Windows.
For more general information about React, deciding between React (web apps), React
Native (mobile apps), and React Native for Windows (desktop apps), see the React
overview.
Prerequisites
Install the latest version of Windows 10 (Version 1903+, Build 18362+) or Windows
11
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like
Ubuntu) and make sure it is running in WSL 2 mode. You can check this by opening
PowerShell and entering: wsl -l -v
Install Node.js on WSL 2: These instructions use Node Version Manager (nvm) for
installation, you will need a recent version of NodeJS to run vite, as well as a recent
version of Node Package Manager (npm).
) Important
Installing a Linux distribution with WSL will create a directory for storing files:
\\wsl\Ubuntu-20.04 (substitute Ubuntu-20.04 with whatever Linux distribution
you're using). To open this directory in Windows File Explorer, open your WSL
command line, select your home directory using cd ~ , then enter the command
explorer.exe . Be careful not to install NodeJS or store files that you will be
Install React
To install the full React toolchain on WSL, we recommend using vite.
2. Create a new project folder: mkdir ReactProjects and enter that directory: cd
ReactProjects .
Bash
4. Once installed, change directories into your new app ("my-react-app" or whatever
you've chosen to call it): cd my-react-app , install the dependencies: npm install
and then start your local development server: npm run dev
This command will start up the Node.js server and launch a new browser window
displaying your app. You can use Ctrl + c to stop running the React app in your
command line.
7 Note
Vite includes a frontend build pipeline using Babel , esbuild and Rollup , but
doesn't handle backend logic or databases. If you are seeking to build a server-
rendered website with React that uses a Node.js backend, we recommend installing
Next.js, rather than this Vite installation, which is intended more for single-page
apps(SPAs). You also may want to consider installing Gatsby if you want to build a
static content-oriented website.
6. When you're ready to deploy your web app to production, running npm run build
to create a build of your app in the "dist" folder. You can learn more in the
Deploying a Static Site .
Additional resources
React docs
Vite
Install Next.js
Install Gatsby
Install React Native for Windows
Install NodeJS on Windows
Install NodeJS on WSL
Try the tutorial: Using React in Visual Studio Code
Try the React learning path
This guide will walk through installing React on a Linux distribution (ie. Ubuntu) running
on the Windows Subsystem for Linux (WSL) using the vite frontend tooling.
We recommend following these instructions if you are new to React and just interested
in learning. If you are creating a single-page app (SPA) that you would like to use Bash
commands or tools with and/or plan to deploy to a Linux server, we recommend that
you install with vite on Windows Subsystem for Linux (WSL).
For more general information about React, deciding between React (web apps), React
Native (mobile apps), and React Native for Windows (desktop apps), see the React
overview.
2. Create a new project folder: mkdir ReactProjects and enter that directory: cd
ReactProjects .
PowerShell
4. Once installed, change directories into your new app ("my-react-app" or whatever
you've chosen to call it): cd my-react-app , install the dependencies: npm install
and then start your local development server: npm run dev
This command will start up the Node.js server and launch a new browser window
displaying your app. You can use Ctrl + c to stop running the React app in your
command line.
7 Note
Vite includes a frontend build pipeline using Babel , esbuild and Rollup , but
doesn't handle backend logic or databases. If you are seeking to build a server-
rendered website with React that uses a Node.js backend, we recommend installing
Next.js, rather than this Vite installation, which is intended more for single-page
apps(SPAs). You also may want to consider installing Gatsby if you want to build a
static content-oriented website.
6. When you're ready to deploy your web app to production, running npm run build
to create a build of your app in the "dist" folder. You can learn more in the
Deploying a Static Site .
Additional resources
React docs
Vite
Install Next.js
Install Gatsby
Install React Native for Windows
Install NodeJS on Windows
Install NodeJS on WSL
Try the tutorial: Using React in Visual Studio Code
Try the React learning path
React Native for Windows allows you to create a Universal Windows Platform (UWP)
app using React.
For more general information about React, see the React overview page.
Prerequisites
The setup requirements for using React Native for Windows can be found on the System
Requirements page. Ensure Developer Mode is turned ON in Windows Settings App.
1. Open a command line window (terminal) and navigate to the directory where you
want to create your Windows desktop app project.
2. You can use this command with the Node Package Executor (NPX) to create a
React Native project without the need to install locally or globally install additional
tools. The command will generate a React Native app in the directory specified by
<projectName> .
PowerShell
PowerShell
3. Switch to the project directory and run the following command to install the React
Native for Windows packages:
PowerShell
cd projectName
npx react-native-windows-init --overwrite
4. To run the app, first launch your web browser (ie. Microsoft Edge), then execute the
following command:
PowerShell
Open the solution file in the application folder in Visual Studio (e.g.,
AwesomeProject/windows/AwesomeProject.sln if you used AwesomeProject as
<projectName>).
Select the Debug configuration and the x64 platform from the combo box controls
to the left of the Run button and underneath the Team and Tools menu item.
Run yarn start from your project directory, and wait for the React Native
packager to report success.
Select Run to the right of the platform combo box control in VS, or select the
Debug->Start without Debugging menu item. You now see your new app and
Chrome should have loaded http://localhost:8081/debugger-ui/ in a new tab.
Select the F12 key or Ctrl+Shift+I to open Developer Tools in your web browser.
Create a new file in the applications root directory, .vscode/launch.json and paste
the following configuration:
JSON
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Windows",
"cwd": "${workspaceFolder}",
"type": "reactnative",
"request": "launch",
"platform": "windows"
}
]
}
Additional resources
React Native for Windows docs
React Native docs
React docs
Install NodeJS on Windows
Try the React learning path
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
Get started developing for Android
using React Native
Article • 06/28/2023
This guide will help you to get started using React Native on Windows to create a cross-
platform app that will work on Android devices.
Overview
React Native is an open-source mobile application framework created by Facebook. It
is used to develop applications for Android, iOS, Web and UWP (Windows) providing
native UI controls and full access to the native platform. Working with React Native
requires an understanding of JavaScript fundamentals.
2. Install Android Studio for Windows . Android Studio installs the latest Android
SDK by default. React Native requires Android 6.0 (Marshmallow) SDK or later. We
recommend using the latest SDK.
3. Create environment variable paths for the Java SDK and Android SDK:
In the Windows search menu, enter: "Edit the system environment variables",
this will open the System Properties window.
Choose Environment Variables... and then choose New... under User
variables.
Enter the Variable name and value (path). The default paths for the Java and
Android SDKs are as follows. If you've chosen a specific location to install the
Java and Android SDKs, be sure to update the variable paths accordingly.
JAVA_HOME: C:\Program Files\Android\Android Studio\jre\bin
ANDROID_HOME: C:\Users\username\AppData\Local\Android\Sdk
4. Install NodeJS for Windows You may want to consider using Node Version
Manager (nvm) for Windows if you will be working with multiple projects and
version of NodeJS. We recommend installing the latest LTS version for new
projects.
7 Note
You may also want to consider installing and using the Windows Terminal for
working with your preferred command-line interface (CLI), as well as, Git for
version control . The Java JDK comes packaged with Android Studio v2.2+, but
if you need to update your JDK separately from Android Studio, use the Windows
x64 Installer .
PowerShell
If you want to start a new project with a specific React Native version, you can use
the --version argument. For information about versions of React Native, see
Versions - React Native .
PowerShell
PowerShell
cd MyReactNativeApp
3. If you want to run your project on a hardware Android device, connect the device
to your computer with a USB cable.
4. If you want to run your project on an Android emulator, you shouldn't need to
take any action as Android Studio installs with a default emulator installed. If you
want to run your app on the emulator for a particular device. Click on the AVD
Manager button in the toolbar.
5. To run your project, enter the following command. This will open a new console
window displaying Node Metro Bundler.
PowerShell
If you are using a new install of Android Studio and haven't yet done any
other Android development, you may get errors at the command line when
you run the app about accepting licenses for the Android SDK. Such as
"Warning: License for package Android SDK Platform 29 not accepted." To
resolve this, you can click the SDK Manager button in Android Studio .
Or, you can list and accept the licenses with the following command, making
sure to use the path to the SDK location on your machine.
PowerShell
C:\Users\[User Name]\AppData\Local\Android\Sdk\tools\bin\sdkmanager --
licenses
6. To modify the app, open the MyReactNativeApp project directory in the IDE of your
choice. We recommend VS Code or Android Studio.
7. The project template created by react-native init uses a main page named
App.js . This page is pre-populated with a lot of useful links to information about
React Native development. Add some text to the first Text element, like the "HELLO
WORLD!" string shown below.
JavaScript
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits. HELLO WORLD!
</Text>
8. Reload the app to show the changes you made. There are several ways to do this.
A guide to help you install the Next.js web framework and get up and running on
Windows.
To learn more about React and other JavaScript frameworks based on React, see the
React overview page.
Prerequisites
This guide assumes that you've already completed the steps to set up your Node.js
development environment, including:
Install the latest version of Windows 10 (Version 1903+, Build 18362+) or Windows
11
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like
Ubuntu) and make sure it is running in WSL 2 mode. You can check this by opening
PowerShell and entering: wsl -l -v
Install Node.js on WSL 2: This includes a version manager, package manager, Visual
Studio Code, and the Remote Development extension.
We recommend using the Windows Subsystem for Linux when working with NodeJS
apps for better performance speed, system call compatibility, and for parity when
running Linux servers or Docker containers.
) Important
Installing a Linux distribution with WSL will create a directory for storing files:
\\wsl\Ubuntu-20.04 (substitute Ubuntu-20.04 with whatever Linux distribution
you're using). To open this directory in Windows File Explorer, open your WSL
command line, select your home directory using cd ~ , then enter the command
explorer.exe . Be careful not to install NodeJS or store files that you will be
working with on the mounted C drive ( /mnt/c/Users/yourname$ ). Doing so will
significantly slow down your install and build times.
Install Next.js
To install Next.js, which includes installing next, react, and react-dom:
2. Create a new project folder: mkdir NextProjects and enter that directory: cd
NextProjects .
3. Install Next.js and create a project (replacing 'my-next-app' with whatever you'd
like to call your app): npx create-next-app@latest my-next-app .
4. Once the package has been installed, change directories into your new app folder,
cd my-next-app , then use code . to open your Next.js project in VS Code. This will
allow you to look at the Next.js framework that has been created for your app.
Notice that VS Code opened your app in a WSL-Remote environment (as indicated
in the green tab on the bottom-left of your VS Code window). This means that
while you are using VS Code for editing on the Windows OS, it is still running your
app on the Linux OS.
Open the WSL terminal integrated in VS Code (View > Terminal). Make sure that
the terminal path is pointed to your project directory (ie. ~/NextProjects/my-next-
app$ ). Then try running a development instance of your new Next.js app using: npm
run dev
6. The local development server will start and once your project pages are done
building, your terminal will display
terminal
- Local: http://localhost:3000
✔ Ready
Select this localhost link to open your new Next.js app in a web browser.
7. Open the app/page.tsx file in your VS Code editor. Find Get started by editing..
and replace everthing inside the <p> tag with This is my new Next.js app!the
page title . With your web browser still open to localhost:3000, save your change
and notice the hot-reloading feature automatically compile and update your
change in the browser.
You can use VS Code's debugger with your Next.js app by selecting the F5 key, or by
going to View > Debug (Ctrl+Shift+D) and View > Debug Console (Ctrl+Shift+Y) in the
menu bar. If you select the gear icon in the Debug window, a launch configuration
( launch.json ) file will be created for you to save debugging setup details. To learn more,
see VS Code Debugging .
To learn more about Next.js, see the Next.js docs .
A guide to help you install the Gatsby.js web framework and get up and running on
Windows.
To learn more about React and other JavaScript frameworks based on React, see the
React overview page.
Prerequisites
This guide assumes that you've already completed the steps to set up your Node.js
development environment, including:
Install the latest version of Windows 10 (Version 1903+, Build 18362+) or Windows
11
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like
Ubuntu) and make sure it is running in WSL 2 mode. You can check this by opening
PowerShell and entering: wsl -l -v
Install Node.js on WSL 2: This includes a version manager, package manager, Visual
Studio Code, and the Remote Development extension.
We recommend using the Windows Subsystem for Linux when working with NodeJS
apps for better performance speed, system call compatibility, and for parody when
running Linux servers or Docker containers.
) Important
Installing a Linux distribution with WSL will create a directory for storing files:
\\wsl\Ubuntu-20.04 (substitute Ubuntu-20.04 with whatever Linux distribution
you're using). To open this directory in Windows File Explorer, open your WSL
command line, select your home directory using cd ~ , then enter the command
explorer.exe . Be careful not to install NodeJS or store files that you will be
working with on the mounted C drive ( /mnt/c/Users/yourname$ ). Doing so will
significantly slow down your install and build times.
Install Gatsby.js
To create a Gatsby.js project:
2. Create a new project folder: mkdir GatsbyProjects and enter that directory: cd
GatsbyProjects
3. Use npm to install the Gatsby CLI: npm install -g gatsby-cli . Once installed,
check the version with gatsby --version .
5. Once the package has been installed, change directories into your new app folder,
cd my-gatsby-app , then use code . to open your Gatsby project in VS Code. This
will allow you to look at the Gatsby.js framework that has been created for your
app using VS Code's File Explorer. Notice that VS Code opened your app in a WSL-
Remote environment (as indicated in the green tab on the bottom-left of your VS
Code window). This means that while you are using VS Code for editing on the
Windows OS, it is still running your app on the Linux OS.
Open the WSL terminal integrated in VS Code (View > Terminal). Make sure that
the terminal path is pointed to your project directory (ie. ~/GatsbyProjects/my-
gatsby-app$ ). Then try running a development instance of your new app using:
gatsby develop
7. Once your new Gatsby project finishes compiling, your terminal will display. You
can now view gatsby-starter-default in the browser. http://localhost:8000/ .
Select this localhost link to view your new project built in a web browser.
7 Note
You'll notice that your terminal output also let's you know that you can "View
GraphiQL, an in-browser IDE, to explore your site's data and schema:
http://localhost:8000/___graphql ." GraphQL consolidates your APIs into a self-
documenting IDE (GraphiQL) built into Gatsby. In addition to exploring your site's
data and schema, you can perform GraphQL operations such as queries, mutations,
and subscriptions. For more info, see Introducing GraphiQL .
8. Open the src/pages/index.js file in your VS Code editor. Find the page title
<h1>Welcome to <b>Gatsby!</b></h1> and change it to <h1>Hello <b>World!</b>
</h1> . With your web browser still open to http://localhost:8000 , save your
change and notice the hot-reloading feature automatically compile and update
your change in the browser.
You can use VS Code's debugger with your Gatsby app by selecting the F5 key, or by
going to View > Debug (Ctrl+Shift+D) and View > Debug Console (Ctrl+Shift+Y) in the
menu bar. If you select the gear icon in the Debug window, a launch configuration
( launch.json ) file will be created for you to save debugging setup details. To learn more,
see VS Code Debugging .
If you're brand new to using React, this guide will help you to get started with some
basics.
Prerequisites
Install React on Windows
Install React on Windows Subsystem for Linux
Install VS Code . We recommend installing VS Code on Windows, regardless of
whether you plan to use React on Windows or WSL.
It is declarative , meaning that you write the code that you want and React takes
that declared code and performs all of the JavaScript/DOM steps to get the
desired result.
The React motto is "Learn once, write anywhere." The intention is for code reuse
and not making assumptions about how you will use React UI with other
technologies, but to make components reusable without the need to rewrite
existing code.
JSX is a syntax extension for JavaScript written to be used with React that looks
like HTML, but is actually a JavaScript file that needs to be compiled, or translated
into regular JavaScript.
Virtual DOM : DOM stands for Document Object Model and represents the UI
of your app. Every time the state of your app's UI changes, the DOM gets updated
to represent the change. When a DOM is frequently updating, performance
becomes slow. A Virtual DOM is only a visual representation of the DOM, so when
the state of the app changes, the virtual DOM is updated rather than the real
DOM, reducing the performance cost. It's a representation of a DOM object, like a
lightweight copy.
Views: are what the user sees rendered in the browser. In React, view is related to
the concept of rendering elements that you want a user to see on their screen.
State : refers to the data stored by different views. The state will typically rely on
who the user is and what the user is doing. For example, signing into a website
may show your user profile (view) with your name (state). The state data will
change based on the user, but the view will remain the same. State is used to
achieve most of the user interactivity with the application.
1. Use vite on Windows or WSL (see the prerequisites above) to create a new project:
npm create vite@latest hello-world -- --template react
2. Change directories so that you're inside the folder for your new app: cd hello-
world , install the dependencies: npm install and then start your local
Your new React Hello World app will compile and open your default web browser
to show that it's running on http://localhost:5173 .
3. Stop running your React app (Ctrl+c) and open it's code files in VS Code by
entering: code .
4. Find the src/App.jsx file and find the header section that reads:
JavaScript
Change it to read:
JavaScript
5. Open your terminal window and start your local development server: npm run dev
or you can use the integrated VS Code terminal (Ctrl + `) and start your
development server from there.
Throughout the development of your React app you can keep your local development
server running and all the changes will immediately be rendered at
http://localhost:5173 in your browser.
markdown
hello-world
├── node_modules
├── README.md
├── index.html
├── package-lock.json
├── package.json
├── public
│ └── vite.svg
├── src
│ ├── App.css
│ ├── App.jsx
│ ├── assets
│ │ └── react.svg
│ ├── index.css
│ └── main.jsx
└── vite.config.js
For starters, these are the important files and folders you need to know.
index.html is the file in which Vite injects your code from src folder for your browser to
run it. This file should not be edited except to change the title of your React application.
The src folder is where the source code of your React application lives. This is the place
where you create your custom components, CSS files and other code files you need to
build your application. These files are processed by Vite's build tools to parse and build
them to create your final React project.
The public folder contains all your static files that will be served directly to your
browser. These files are not processed by Vite.
1. Lets start fresh. We will remove almost all the boilerplate code provided by Vite
and keep only our code from the previous step.
JavaScript
import "./App.css";
function App() {
return (
<>
<p>Hello world! This is my first React app.</p>
</>
);
}
2. Next, let's set a local state where we can save data from an API. A state is where we
can store data to be used in the view.
To add a local state, we need to first import the useState React Hook that lets
you add state variable to your component.
We also need to initialize the local state. The useState returns an array of two
values; current state and a set function. We will call our current state as posts
initialised as an empty array that we can fill with post data later from our API using
the setPosts function.
JavaScript
import { useState } from "react";
import "./App.css";
function App() {
const [posts, setPosts] = useState([]);
return (
<>
<p>Hello world! This is my first React app.</p>
</>
);
}
3. To call an API with data for us to use in our React app, we will use the .fetch
JavaScript method. The API we will call is JSONPlaceholder , a free API for testing
and prototyping that serves up fake placeholder data in JSON format.
We use the useEffect React Hook to update the posts state by using the set
function .
Javascript
function App() {
const [posts, setPosts] = useState([]);
useEffect(() => {
const url = "https://jsonplaceholder.typicode.com/albums/1/photos";
fetch(url)
.then((response) => response.json())
.then((data) => setPosts(data));
}, []);
return (
<>
<p>Hello world! This is my first React app.</p>
</>
);
}
4. Let's take a look at what sort of data the API has saved in our posts state. Below is
some of the contents of the fake JSON API file . We can see the format the data is
listed in, using the categories: "albumId", "id", "title", "url", and "thumbnailUrl".
JSON
[
{
"albumId": 1,
"id": 1,
"title": "accusamus beatae ad facilis cum similique qui sunt",
"url": "https://via.placeholder.com/600/92c952",
"thumbnailUrl": "https://via.placeholder.com/150/92c952"
},
{
"albumId": 1,
"id": 2,
"title": "reprehenderit est deserunt velit ipsam",
"url": "https://via.placeholder.com/600/771796",
"thumbnailUrl": "https://via.placeholder.com/150/771796"
}
]
5. To display the API data, we will now need to add a bit of JSX code inside the
rendered return() statement. We will use the map() method to display our data
from the posts object that we stored it in as keys. Each post will display a header
with "ID #" and then the post.id key value + post.title key value from our JSON
data. Followed by the body displaying the image based on the thumbnailUrl key
value.
JavaScript
Vue is an open-source, front end JavaScript framework for building user interfaces and
single-page applications on the web. Created by Evan You, released in 2014 and
maintained by Evan and his core team, Vue focuses on declarative rendering and
component composition offering a core library for the view layer only.
If you want to build a server-rendered Vue web app with advanced features such as
routing, state management and build tooling, take a look at Nuxt.js.
Vue tools
Vue.js is focused only on the view layer, so may require additional tools to create a more
complex app. You may want to consider using:
Package manager: Two popular package managers for Vue are npm (which is
included with NodeJS) and yarn . Both support a broad library of well-maintained
packages that can be installed.
Vue CLI : a standard toolkit for rapid Vue.js development with out-of-the-box
support for Babel, PostCSS, TypeScript, ESLint, etc.
Nuxt.js: A framework to make server-side rendered Vue.js apps possible. Server-
side rendering can improve SEO and make user interfaces more responsive.
Vue extension pack for VS Code : Adds syntax highlighting, code formatting, and
code snippets to your .vue files.
Vuetify : A Vue UI library offering Material Design Framework components.
Vuesion : A Vue boilerplate for production-ready Progressive Web Apps (PWAs).
Storybook : A development and testing environment for Vue user interface
components.
Vue Router : Supports mapping application URLs to Vue components.
Vue Design System : An open source tool for building Design Systems with
Vue.js.
VueX : State management system for Vue apps.
Additional resources
Vue docs
Vue.js overview
Install Vue.js on WSL
Install Vue.js on Windows
Install Nuxt.js
Take your first steps with Vue.js learning path
Try a Vue tutorial with VS Code
Prerequisites
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like
Ubuntu) and make sure it is running in WSL 2 mode. You can check this by opening
PowerShell and entering: wsl -l -v
Install Node.js on WSL 2: This includes a version manager, package manager, Visual
Studio Code, and the Remote Development extension. The Node Package Manager
(npm) is used to install Vue.js.
) Important
Installing a Linux distribution with WSL will create a directory for storing files:
\\wsl\Ubuntu-20.04 (substitute Ubuntu-20.04 with whatever Linux distribution
you're using). To open this directory in Windows File Explorer, open your WSL
command line, select your home directory using cd ~ , then enter the command
explorer.exe . Be careful not to install or store files that you will be working with
Install Vue.js
To install Vue.js on WSL:
Bash
Check the version number you have installed by using the command: vue --version .
7 Note
To install Vue.js using a CDN, rather than NPM, see the Vue.js install docs .
To install Vue CLI, use npm. You must use the -g flag to globally install in order to
upgrade ( vue upgrade --next ):
Bash
To learn more about additional plugins that can be added (such as linting or Apollo for
integrating GraphQL), visit Vue CLI plugins in the Vue CLI docs.
Additional resources
Vue docs
Vue.js overview
Install Vue.js on Windows
Install Nuxt.js
Microsoft Learn online course: Take your first steps with Vue.js
Try a Vue tutorial with VS Code
A guide to help you set up a Vue.js development environment on Windows. Learn more
on the Vue.js overview page.
Vue can be installed directly on Windows or on the Windows Subsystem for Linux (WSL).
We generally recommend that you install Vue on WSL if you are planning to interact
with a NodeJS backend, want parity with a Linux production server, or plan to follow
along with a tutorial that utilizes Bash commands. You may also want to consider Vite
as an alternative to Vue.js.
Prerequisites
Install Node.js on Windows: This includes a version manager, package manager,
and Visual Studio Code. The Node Package Manager (npm) is used to install Vue.js.
Install Vue.js
To install Vue.js:
2. Create a new project folder: mkdir VueProjects and enter that directory: cd
VueProjects .
PowerShell
Check the version number you have installed by using the command: vue --version .
7 Note
To install Vue.js using a CDN, rather than NPM, see the Vue.js install docs . See
the Vue docs for an Explanation of different Vue builds .
Install Vue CLI
Vue CLI is a toolkit for working with Vue in your terminal / command line. It enables you
to quickly scaffold a new project (vue create), prototype new ideas (vue serve), or
manage projects using a graphical user interface (vue ui). Vue CLI is a globally installed
npm package that handles some of the build complexities (like using Babel or Webpack)
for you. If you are not building a new single-page app, you may not need or want Vue CLI.
To install Vue CLI, use npm. You must use the -g flag to globally install in order to
upgrade ( vue upgrade --next ):
PowerShell
To learn more about additional plugins that can be added (such as linting or Apollo for
integrating GraphQL), visit Vue CLI plugins in the Vue CLI docs.
Additional resources
Vue docs
Vue.js overview
Install Vue.js on WSL
Install Nuxt.js
Take your first steps with Vue.js learning path
Try a Vue tutorial with VS Code
A guide to help you install the Nuxt.js web framework and get up and running on
Windows.
Prerequisites
This guide assumes that you've already completed the steps to set up your Node.js
development environment, including:
Install Windows Subsystem for Linux (WSL), including a Linux distribution (like
Ubuntu) and make sure it is running in WSL 2 mode. You can check this by opening
PowerShell and entering: wsl -l -v
Install Node.js on WSL 2: This includes a version manager, package manager, Visual
Studio Code, and the Remote Development extension.
We recommend using the Windows Subsystem for Linux when working with NodeJS
apps for better performance speed, system call compatibility, and for parody when
running Linux servers or Docker containers.
) Important
Installing a Linux distribution with WSL will create a directory for storing files:
\\wsl\Ubuntu-20.04 (substitute Ubuntu-20.04 with whatever Linux distribution
you're using). To open this directory in Windows File Explorer, open your WSL
command line, select your home directory using cd ~ , then enter the command
explorer.exe . Be careful not to install NodeJS or store files that you will be
2. Create a new project folder: mkdir NuxtProjects and enter that directory: cd
NuxtProjects .
3. Install Nuxt.js and create a project (replacing 'my-nuxt-app' with whatever you'd
like to call your app): npm create nuxt-app my-nuxt-app
4. The Nuxt.js installer will now ask you the following questions:
npm run dev for running a development instance with hot-reloading, file
Open the WSL terminal integrated in VS Code (View > Terminal). Make sure that
the terminal path is pointed to your project directory (ie. ~/NuxtProjects/my-nuxt-
app$ ). Then try running a development instance of your new Nuxt.js app using: npm
run dev
7. The local development server will start (displaying some kind of cool progress bars
for the client and server compiles). Once your project is done building, your
terminal will display "Compiled successfully" along with how much time it took to
compile. Point your web browser to http://localhost:3000 to open your new
Nuxt.js app.
8. Open the pages/index.vue file in your VS Code editor. Find the page title <v-card-
title class="headline">Welcome to the Vuetify + Nuxt.js template</v-card-
title> and change it to <v-card-title class="headline">This is my new Nuxt.js
app!</v-card-title> . With your web browser still open to localhost:3000, save your
change and notice the hot-reloading feature automatically compile and update
your change in the browser.
9. Let's see how Nuxt.js handles errors. Remove the </v-card-title> closing tag so
that your title code now looks like this: <v-card-title class="headline">This is my
new Nuxt.js app! . Save this change and notice that a compiling error will display in
your browser, and in your terminal, letting your know that a closing tag for <v-
card-title> is missing, along with the line numbers where the error can be found
in your code. Replace the </v-card-title> closing tag, save, and the page will
reload.
You can use VS Code's debugger with your Nuxt.js app by selecting the F5 key, or by
going to View > Debug (Ctrl+Shift+D) and View > Debug Console (Ctrl+Shift+Y) in the
menu bar. If you select the gear icon in the Debug window, a launch configuration
( launch.json ) file will be created for you to save debugging setup details. To learn more,
see VS Code Debugging .
If you're brand new to using Vue.js, this guide will help you to get started with some
basics.
Prerequisites
You must first install Vue.js on Windows or on Windows Subsystem for Linux.
1. Open your command line and create a new directory: mkdir HelloVue , then enter
the directory: cd HelloVue
You'll need to choose whether to use Vue 2 or Vue 3 Preview , or manually select
the features you want.
5. Try running you new Vue app in your web browser: npm run serve
If using WSL (with Ubuntu or your favorite Linux distribution) for this tutorial,
you'll need to make sure that you have the Remote - WSL Extension
installed for the best experience running and editing your code with VS
remote server.
6. Try updating the welcome message by opening your Vue app's source code in VS
Code, enter: code .
7. VS Code will launch and display your Vue application in the File Explorer. Run your
app in the terminal again with npm run serve and have your web browser open to
the localhost so that you can see the Vue page welcome page displayed. Find the
App.vue file in VS Code. Try changing "Welcome to your Vue.js App" to "Welcome
to the Jungle!". You will see your Vue app "hot reload" as soon as you save your
change.
Additional resources
Using Vue in Visual Studio Code : Find more about using Vue with VS Code,
including the Vetur extension that provides Vue syntax highlighting, IntelliSense,
debugging support, and more.
Vue.js docs
Vue.js overview
Take your first steps with Vue.js learning path
c HOW-TO GUIDE
g TUTORIAL
c HOW-TO GUIDE
g TUTORIAL
c HOW-TO GUIDE
g TUTORIAL
f QUICKSTART
Install and run MySQL, PostgreSQL, SQLite, Microsoft SQL Server, MongoDB, or Redis
Get started using Python on Windows
for beginners
Article • 03/10/2023
The following is a step-by-step guide for beginners interested in learning Python using
Windows.
If you are using Python on Windows for web development, we recommend a different
set up for your development environment. Rather than installing directly on Windows,
we recommend installing and using Python via the Windows Subsystem for Linux. For
help, see: Get started using Python for web development on Windows. If you're
interested in automating common tasks on your operating system, see our guide: Get
started using Python on Windows for scripting and automation. For some advanced
scenarios (like needing to access/modify Python's installed files, make copies of binaries,
or use Python DLLs directly), you may want to consider downloading a specific Python
release directly from python.org or consider installing an alternative , such as
Anaconda, Jython, PyPy, WinPython, IronPython, etc. We only recommend this if you are
a more advanced Python programmer with a specific reason for choosing an alternative
implementation.
Install Python
To install Python using the Microsoft Store:
1. Go to your Start menu (lower left Windows icon), type "Microsoft Store", select the
link to open the store.
2. Once the store is open, select Search from the upper-right menu and enter
"Python". Select which version of Python you would like to use from the results
under Apps. We recommend using the most recent unless you have a reason not
to (such as aligning with the version used on a pre-existing project that you plan to
work on). Once you've determined which version you would like to install, select
Get.
3. Once Python has completed the downloading and installation process, open
Windows PowerShell using the Start menu (lower left Windows icon). Once
PowerShell is open, enter Python --version to confirm that Python3 has installed
on your machine.
4. The Microsoft Store installation of Python includes pip, the standard package
manager. Pip allows you to install and manage additional packages that are not
part of the Python standard library. To confirm that you also have pip available to
install and manage packages, enter pip --version .
VS Code also contains a built-in terminal that enables you to open a Python
command line with Windows Command prompt, PowerShell, or whatever you prefer,
establishing a seamless workflow between your code editor and command line.
2. Once VS Code has been installed, you must also install the Python extension. To
install the Python extension, you can select the VS Code Marketplace link or
open VS Code and search for Python in the extensions menu (Ctrl+Shift+X).
3. Python is an interpreted language, and in order to run Python code, you must tell
VS Code which interpreter to use. We recommend using the most recent version of
Python unless you have a specific reason for choosing something different. Once
you've installed the Python extension, select a Python 3 interpreter by opening the
Command Palette (Ctrl+Shift+P), start typing the command Python: Select
Interpreter to search, then select the command. You can also use the Select
Python Environment option on the bottom Status Bar if available (it may already
show a selected interpreter). The command presents a list of available interpreters
that VS Code can find automatically, including virtual environments. If you don't
see the desired interpreter, see Configuring Python environments .
4. To open the terminal in VS Code, select View > Terminal, or alternatively use the
shortcut Ctrl+` (using the backtick character). The default terminal is PowerShell.
5. Inside your VS Code terminal, open Python by simply entering the command:
python
6. Try the Python interpreter out by entering: print("Hello World") . Python will
return your statement "Hello World".
1. Download and install Git for Windows from the git-scm website .
2. An Install Wizard is included that will ask you a series of questions about settings
for your Git installation. We recommend using all of the default settings, unless
you have a specific reason for changing something.
3. If you've never worked with Git before, GitHub Guides can help you get started.
Hello World tutorial for some Python basics
Python, according to its creator Guido van Rossum, is a “high-level programming
language, and its core design philosophy is all about code readability and a syntax
which allows programmers to express concepts in a few lines of code.”
1. With your PowerShell command line open, enter python to run the Python 3
interpreter. (Some instructions prefer to use the command py or python3 , these
should also work). You will know that you're successful because a >>> prompt
with three greater-than symbols will display.
2. There are several built-in methods that allow you to make modifications to strings
in Python. Create a variable, with: variable = 'Hello World!' . Press Enter for a new
line.
3. Print your variable with: print(variable) . This will display the text "Hello World!".
4. Find out the length, how many characters are used, of your string variable with:
len(variable) . This will display that there are 12 characters used. (Note that the
6. Count how many times the letter "l" is used in your string variable:
variable.count("l") .
7. Search for a specific character in your string variable, let's find the exclamation
point, with: variable.find("!") . This will display that the exclamation point is
found in the 11th position character of the string.
1. Open PowerShell and create an empty folder called "hello", navigate into this
folder, and open it in VS Code:
Console
mkdir hello
cd hello
code .
2. Once VS Code opens, displaying your new hello folder in the left-side Explorer
window, open a command line window in the bottom panel of VS Code by
pressing Ctrl+` (using the backtick character) or selecting View > Terminal. By
starting VS Code in a folder, that folder becomes your "workspace". VS Code stores
settings that are specific to that workspace in .vscode/settings.json, which are
separate from user settings that are stored globally.
3. Continue the tutorial in the VS Code docs: Create a Python Hello World source
code file .
Create a simple game with Pygame
Pygame is a popular Python package for writing games - encouraging students to learn
programming while creating something fun. Pygame displays graphics in a new window,
and so it will not work under the command-line-only approach of WSL. However, if you
installed Python via the Microsoft Store as detailed in this tutorial, it will work fine.
1. Once you have Python installed, install pygame from the command line (or the
terminal from within VS Code) by typing python -m pip install -U pygame --user .
3. All being well, the game will open a window. Close the window when you are done
playing.
1. Open PowerShell (or Windows Command Prompt) and create an empty folder
called "bounce". Navigate to this folder and create a file named "bounce.py". Open
the folder in VS Code:
PowerShell
mkdir bounce
cd bounce
new-item bounce.py
code .
2. Using VS Code, enter the following Python code (or copy and paste it):
Python
pygame.init()
screen = pygame.display.set_mode(size)
while 1:
x += dx
y += dy
screen.fill(black)
pygame.display.flip()
Microsoft Dev Blogs: Python : Read the latest updates about all things Python at
Microsoft.
Python Tutorial For Beginners : A complete and free Python tutorial with
interactive (runnable) code examples, ideal for both complete beginners and those
with prior experience.
LearnPython.org Tutorials : Get started on learning Python without needing to
install or set anything up with these free interactive Python tutorials from the folks
at DataCamp.
The Python.org Tutorials : Introduces the reader informally to the basic concepts
and features of the Python language and system.
Linting Python : Linting is the process of running a program that will analyse
code for potential errors. Learn about the different forms of linting support VS
Code provides for Python and how to set it up.
Unit testing Python : Covers some background explaining what unit testing
means, an example walkthrough, enabling a test framework, creating and running
your tests, debugging tests, and test configuration settings.
Get started using Python for web
development on Windows
Article • 11/01/2023
The following is a step-by-step guide to get you started using Python for web
development on Windows, using the Windows Subsystem for Linux (WSL).
If you are using Python for something other than web development, we recommend you
install Python directly on Windows using the Microsoft Store. WSL does not support GUI
desktops or applications (like PyGame, Gnome, KDE, etc). Install and use Python directly
on Windows for these cases. If you're new to Python, see our guide: Get started using
Python on Windows for beginners. If you're interested in automating common tasks on
your operating system, see our guide: Get started using Python on Windows for
scripting and automation. For some advanced scenarios, you may want to consider
downloading a specific Python release directly from python.org or consider installing
an alternative , such as Anaconda, Jython, PyPy, WinPython, IronPython, etc. We only
recommend this if you are a more advanced Python programmer with a specific reason
for choosing an alternative implementation.
To enable and install WSL 2, see the WSL install documentation. These steps will include
choosing a Linux distribution (for example, Ubuntu).
Once you have installed WSL and a Linux distribution, open the Linux distribution (it can
be found in your Windows start menu) and check the version and codename using the
command: lsb_release -dc .
We recommend updating your Linux distribution regularly, including immediately after
you install, to ensure you have the most recent packages. Windows doesn't
automatically handle this update. To update your distribution, use the command: sudo
apt update && sudo apt upgrade .
Tip
Consider installing the new Windows Terminal from the Microsoft Store to
enable multiple tabs (quickly switch between multiple Linux command lines,
Windows Command Prompt, PowerShell, Azure CLI, etc), create custom key
bindings (shortcut keys for opening or closing tabs, copy+paste, etc.), use the
search feature, and set up custom themes (color schemes, font styles and sizes,
background image/blur/transparency). Learn more.
1. Download and install VS Code for Windows . VS Code is also available for Linux,
but Windows Subsystem for Linux does not support GUI apps, so we need to
install it on Windows. Not to worry, you'll still be able to integrate with your Linux
command line and tools using the Remote - WSL Extension.
2. Install the Remote - WSL Extension on VS Code. This allows you to use WSL as
your integrated development environment and will handle compatibility and
pathing for you. Learn more .
) Important
If you already have VS Code installed, you need to ensure that you have the 1.35
May release or later in order to install the Remote - WSL Extension . We do not
recommend using WSL in VS Code without the Remote-WSL extension as you will
lose support for auto-complete, debugging, linting, etc. Fun fact: This WSL
extension is installed in $HOME/.vscode-server/extensions.
Create a new project
Let's create a new project directory on our Linux (Ubuntu) file system that we will then
work on with Linux apps and tools using VS Code.
1. Close VS Code and open Ubuntu 18.04 (your WSL command line) by going to your
Start menu (lower left Windows icon) and typing: "Ubuntu 18.04".
2. In your Ubuntu command line, navigate to where you want to put your project,
and create a directory for it: mkdir HelloWorld .
Tip
An important thing to remember when using Windows Subsystem for Linux (WSL)
is that you are now working between two different file systems: 1) your Windows
file system, and 2) your Linux file system (WSL), which is Ubuntu for our example.
You will need to pay attention to where you install packages and store files. You can
install one version of a tool or package in the Windows file system and a
completely different version in the Linux file system. Updating the tool in the
Windows file system will have no effect on the tool in the Linux file system, and
vice-versa. WSL mounts the fixed drives on your computer under the /mnt/<drive>
folder in your Linux distribution. For example, your Windows C: drive is mounted
under /mnt/c/ . You can access your Windows files from the Ubuntu terminal and
use Linux apps and tools on those files and vice-versa. We recommend working in
the Linux file system for Python web development given that much of the web
tooling is originally written for Linux and deployed in a Linux production
environment. It also avoids mixing file system semantics (like Windows being case-
insensitive regarding file names). That said, WSL now supports jumping between
the Linux and Windows files systems, so you can host your files on either one.
Learn more .
1. Confirm that Python3 is already installed by opening your Ubuntu terminal and
entering: python3 --version . This should return your Python version number. If
you need to update your version of Python, first update your Ubuntu version by
entering: sudo apt update && sudo apt upgrade , then update Python using sudo
apt upgrade python3 .
2. Install pip by entering: sudo apt install python3-pip . Pip allows you to install and
manage additional packages that are not part of the Python standard library.
1. Open your terminal and, inside your HelloWorld project folder, use the following
command to create a virtual environment named .venv: python3 -m venv .venv .
Tip
We recommend creating the virtual environment inside the directory in which you
plan to have your project. Since each project should have its own separate
directory, each will have its own virtual environment, so there is not a need for
unique naming. Our suggestion is to use the name .venv to follow the Python
convention. Some tools (like pipenv) also default to this name if you install into
your project directory. You don't want to use .env as that conflicts with
environment variable definition files. We generally do not recommend non-dot-
leading names, as you don't need ls constantly reminding you that the directory
exists. We also recommend adding .venv to your .gitignore file. (Here is GitHub's
default gitignore template for Python for reference.) For more information
about working with virtual environments in VS Code, see Using Python
environments in VS Code .
1. Open your project folder in VS Code from your Ubuntu terminal by entering: code
. (the "." tells VS Code to open the current folder).
2. A Security Alert will pop-up from Windows Defender, select "Allow access". Once
VS Code opens, you should see the Remote Connection Host indicator, in the
bottom-left corner, letting you know that you are editing on WSL: Ubuntu-18.04.
3. Close your Ubuntu terminal. Moving forward we will use the WSL terminal
integrated into VS Code.
4. Open the WSL terminal in VS Code by pressing Ctrl+` (using the backtick
character) or selecting View > Terminal. This will open a bash (WSL) command-line
opened to the project folder path that you created in your Ubuntu terminal.
Install the Microsoft Python extension
You will need to install any VS Code extensions for your Remote - WSL. Extensions
already installed locally on VS Code will not automatically be available. Learn more .
1. Open the VS Code Extensions window by entering Ctrl+Shift+X (or use the menu
to navigate to View > Extensions).
3. Find the Python (ms-python.python) by Microsoft extension and select the green
Install button.
4. Once the extension is finished installing, you will need to select the blue Reload
Required button. This will reload VS Code and display a WSL: UBUNTU-18.04 -
Installed section in your VS Code Extensions window showing that you've installed
the Python extension.
Let's create and run a simple Python program as a test and ensure that we have the
correct Python interpreter selected.
1. Open the VS Code File Explorer window by entering Ctrl+Shift+E (or use the menu
to navigate to View > Explorer).
2. If it's not already open, open your integrated WSL terminal by entering
Ctrl+Shift+` and ensure that your HelloWorld python project folder is selected.
3. Create a python file by entering: touch test.py . You should see the file you just
created appear in your Explorer window under the .venv and .vscode folders
already in your project directory.
4. Select the test.py file that you just created in your Explorer window to open it in VS
Code. Because the .py in our file name tells VS Code that this is a Python file, the
Python extension you loaded previously will automatically choose and load a
Python interpreter that you will see displayed on the bottom of your VS Code
window.
5. Paste this Python code into your test.py file and then save the file (Ctrl+S):
Python
print("Hello World")
6. To run the Python "Hello World" program that we just created, select the test.py
file in the VS Code Explorer window, then right-click the file to display a menu of
options. Select Run Python File in Terminal. Alternatively, in your integrated WSL
terminal window, enter: python test.py to run your "Hello World" program. The
Python interpreter will print "Hello World" in your terminal window.
Congratulations. You're all set up to create and run Python programs! Now let's try
creating a Hello World app with two of the most popular Python web frameworks: Flask
and Django.
1. Open Ubuntu 18.04 (your WSL command line) by going to your Start menu (lower
left Windows icon) and typing: "Ubuntu 18.04".
3. Create a virtual environment to install your project tools: python3 -m venv .venv
5. Inside VS Code, open your integrated WSL terminal (aka Bash) by entering
Ctrl+Shift+` (your HelloWorld-Flask project folder should already be selected).
Close your Ubuntu command line as we will be working in the WSL terminal
integrated with VS Code moving forward.
6. Activate the virtual environment that you created in step #3 using your Bash
terminal in VS Code: source .venv/bin/activate . If it worked, you should see
(.venv) before the command prompt.
7. Install Flask in the virtual environment by entering: python3 -m pip install flask .
Verify that it's installed by entering: python3 -m flask --version .
9. Open your app.py file in VS Code's File Explorer ( Ctrl+Shift+E , then select your
app.py file). This will activate the Python Extension to choose an interpreter. It
should default to Python 3.6.8 64-bit ('.venv': venv). Notice that it also detected
your virtual environment.
10. In app.py, add code to import Flask and create an instance of the Flask object:
Python
Python
@app.route("/")
def home():
return "Hello World! I'm using Flask."
Tip
You can use multiple decorators on the same function, one per line,
depending on how many different routes you want to map to the same
function.
13. In the terminal, run the app by entering the following command:
Python
This runs the Flask development server. The development server looks for app.py
by default. When you run Flask, you should see output similar to the following:
Bash
14. Open your default web browser to the rendered page, Ctrl+Click the
http://127.0.0.1:5000/ URL in the terminal. You should see the following message
in your browser:
15. Observe that when you visit a URL like "/", a message appears in the debug
terminal showing the HTTP request:
Bash
Tip
If you want to use a different filename than app.py, such as program.py, define an
environment variable named FLASK_APP and set its value to your chosen file.
Flask's development server then uses the value of FLASK_APP instead of the default
file app.py. For more information, see the Flask documentation .
Congratulations, you've created a Flask web application using Visual Studio Code and
Windows Subsystem for Linux! For a more in-depth tutorial using VS Code and Flask,
see Flask Tutorial in Visual Studio Code .
1. Open Ubuntu 18.04 (your WSL command line) by going to your Start menu (lower
left Windows icon) and typing: "Ubuntu 18.04".
3. Create a virtual environment to install your project tools: python3 -m venv .venv
5. Inside VS Code, open your integrated WSL terminal (aka Bash) by entering
Ctrl+Shift+` (your HelloWorld-Django project folder should already be selected).
Close your Ubuntu command line as we will be working in the WSL terminal
integrated with VS Code moving forward.
6. Activate the virtual environment that you created in step #3 using your Bash
terminal in VS Code: source .venv/bin/activate . If it worked, you should see
(.venv) before the command prompt.
7. Install Django in the virtual environment with the command: python3 -m pip
install django . Verify that it's installed by entering: python3 -m django --version .
Bash
The startproject command assumes (by use of . at the end) that the current
folder is your project folder, and creates the following within it:
You run administrative commands for the project using python manage.py
<command> [options] .
package.
wsgi.py : an entry point for WSGI-compatible web servers to serve your
project. You typically leave this file as-is as it provides the hooks for
production web servers.
settings.py : contains settings for Django project, which you modify in the
9. To verify the Django project, start Django's development server using the
command python3 manage.py runserver . The server runs on the default port 8000,
and you should see output like the following output in the terminal window:
Output
When you run the server the first time, it creates a default SQLite database in the
file db.sqlite3 , which is intended for development purposes, but can be used in
production for low-volume web apps. Also, Django's built-in web server is
intended only for local development purposes. When you deploy to a web host,
however, Django uses the host's web server instead. The wsgi.py module in the
Django project takes care of hooking into the production servers.
If you want to use a different port than the default 8000, specify the port number
on the command line, such as python3 manage.py runserver 5000 .
11. When you're done, close the browser window and stop the server in VS Code using
Ctrl+C as indicated in the terminal output window.
12. Now, to create a Django app, run the administrative utility's startapp command in
your project folder (where manage.py resides):
Bash
The command creates a folder called hello that contains a number of code files
and one subfolder. Of these, you frequently work with views.py (that contains the
functions that define pages in your web app) and models.py (that contains classes
defining your data objects). The migrations folder is used by Django's
administrative utility to manage database versions as discussed later in this
tutorial. There are also the files apps.py (app configuration), admin.py (for creating
an administrative interface), and tests.py (for tests), which are not covered here.
13. Modify hello/views.py to match the following code, which creates a single view
for the app's home page:
Python
def home(request):
return HttpResponse("Hello, Django!")
14. Create a file, hello/urls.py , with the contents below. The urls.py file is where you
specify patterns to route different URLs to their appropriate views. The code below
contains one route to map root URL of the app ( "" ) to the views.home function
that you just added to hello/views.py :
Python
urlpatterns = [
path("", views.home, name="home"),
]
15. The web_project folder also contains a urls.py file, which is where URL routing is
actually handled. Open web_project/urls.py and modify it to match the following
code (you can retain the instructive comments if you like). This code pulls in the
app's hello/urls.py using django.urls.include , which keeps the app's routes
contained within the app. This separation is helpful when a project contains
multiple apps.
Python
urlpatterns = [
path("", include("hello.urls")),
]
17. In the VS Code Terminal, run the development server with python3 manage.py
runserver and open a browser to http://127.0.0.1:8000/ to see a page that
Congratulations, you've created a Django web application using VS Code and Windows
Subsystem for Linux! For a more in-depth tutorial using VS Code and Django, see
Django Tutorial in Visual Studio Code .
Additional resources
Microsoft Dev Blogs: Python : Read the latest updates about all things Python at
Microsoft.
Python Tutorial with VS Code : An intro tutorial to VS Code as a Python
environment, primarily how to edit, run, and debug code.
Git support in VS Code : Learn how to use Git version control basics in VS Code.
Learn about updates coming soon with WSL 2!: This new version changes how
Linux distributions interact with Windows, increasing file system performance and
adding full system call compatibility.
Working with multiple Linux distributions on Windows: Learn how to manage
multiple different Linux distributions on your Windows machine.
Get started using Python on Windows
for scripting and automation
Article • 05/25/2021
The following is a step-by-step guide for setting up your developer environment and
getting you started using Python for scripting and automating file system operations on
Windows.
7 Note
This article will cover setting up your environment to use some of the helpful
libraries in Python that can automate tasks across platforms, like searching your file
system, accessing the internet, parsing file types, etc., from a Windows-centered
approach. For Windows-specific operations, check out ctypes , a C-compatible
foreign function library for Python, winreg , functions exposing the Windows
registry API to Python, and Python/WinRT , enabling access Windows Runtime
APIs from Python.
If you are using Python for web development on Windows, we recommend a different
setup using the Windows Subsystem for Linux. Find a walkthrough in our guide: Get
started using Python for web development on Windows. If you're brand new to Python,
try our guide: Get started using Python on Windows for beginners. For some advanced
scenarios (like needing to access/modify Python's installed files, make copies of binaries,
or use Python DLLs directly), you may want to consider downloading a specific Python
release directly from python.org or consider installing an alternative , such as
Anaconda, Jython, PyPy, WinPython, IronPython, etc. We only recommend this if you are
a more advanced Python programmer with a specific reason for choosing an alternative
implementation.
Install Python
To install Python using the Microsoft Store:
1. Go to your Start menu (lower left Windows icon), type "Microsoft Store", select the
link to open the store.
2. Once the store is open, select Search from the upper-right menu and enter
"Python". Select which version of Python you would like to use from the results
under Apps. We recommend using the most recent unless you have a reason not
to (such as aligning with the version used on a pre-existing project that you plan to
work on). Once you've determined which version you would like to install, select
Get.
3. Once Python has completed the downloading and installation process, open
Windows PowerShell using the Start menu (lower left Windows icon). Once
PowerShell is open, enter Python --version to confirm that Python3 has been
installed on your machine.
4. The Microsoft Store installation of Python includes pip, the standard package
manager. Pip allows you to install and manage additional packages that are not
part of the Python standard library. To confirm that you also have pip available to
install and manage packages, enter pip --version .
1. Open the VS Code Extensions window by entering Ctrl+Shift+X (or use the menu
to navigate to View > Extensions).
1. Open the terminal in VS Code, select View > Terminal, or alternatively use the
shortcut Ctrl+` (using the backtick character).
7 Note
The default terminal should be PowerShell, but if you need to change it, use
Ctrl+Shift+P to enter the command pallette. Enter Terminal: Select Default
Shell and a list of terminal options will display containing PowerShell,
Command Prompt, WSL, etc. Select the one you'd like to use and enter
Ctrl+Shift+` (using the backtick) to create a new terminal.
3. Try the Python interpreter out by entering: print("Hello World") . Python will
return your statement "Hello World".
1. Download and install Git for Windows from the git-scm website .
2. An Install Wizard is included that will ask you a series of questions about settings
for your Git installation. We recommend using all of the default settings, unless
you have a specific reason for changing something.
3. If you've never worked with Git before, GitHub Guides can help you get started.
Let's begin with a simple script that walks a directory tree and displays the directory
structure.
1. Open PowerShell using the Start menu (lower left Windows icon).
2. Create a directory for your project: mkdir python-scripts , then open that directory:
cd python-scripts .
PowerShell
4. Create a few files within those directories to use with our script:
PowerShell
new-item food\fruits\banana.txt, food\fruits\strawberry.txt,
food\fruits\blueberry.txt, food\fruits\apples\honeycrisp.txt,
food\fruits\oranges\mandarin.txt, food\vegetables\carrot.txt
PowerShell
mkdir src
new-item src\list-directory-contents.py
7. Open the VS Code File Explorer window by entering Ctrl+Shift+E (or use the menu
to navigate to View > Explorer) and select the list-directory-contents.py file that
you just created. The Microsoft Python extension will automatically load a Python
interpreter. You can see which interpreter was loaded on the bottom of your VS
Code window.
7 Note
8. Paste the following code into your list-directory-contents.py file and then select
save:
Python
import os
9. Open the VS Code integrated terminal (Ctrl+`, using the backtick character) and
enter the src directory where you just saved your Python script:
PowerShell
cd src
PowerShell
python3 .\list-directory-contents.py
PowerShell
Directory: ..\food
Subdirectory: fruits
Subdirectory: vegetables
Directory: ..\food\fruits
Subdirectory: apples
Subdirectory: oranges
File: banana.txt
File: blueberry.txt
File: strawberry.txt
Directory: ..\food\fruits\apples
File: honeycrisp.txt
Directory: ..\food\fruits\oranges
File: mandarin.txt
Directory: ..\food\vegetables
File: carrot.txt
11. Use Python to print that file system directory output to it's own text file by
entering this command directly in your PowerShell terminal: python3 list-
directory-contents.py > food-directory.txt
7 Note
If you're unable to install Python 3 from the Microsoft Store, see this issue for an
example of how to handle the pathing for this sample script.
1. Inside the src folder in your python-scripts directory, create a new Python file for
your script:
PowerShell
new-item update-filenames.py
2. Open the update-filenames.py file, paste the following code into the file, and save
it:
7 Note
Python
import datetime
import os
os.rename(source_name, target_name)
PowerShell
Directory: ..\food\fruits
Subdirectory: apples
Subdirectory: oranges
File: 2019-07-18 12.24.46.385185_banana.txt
File: 2019-07-18 12.24.46.389174_strawberry.txt
File: 2019-07-18 12.24.46.391170_blueberry.txt
Directory: ..\food\fruits\apples
File: 2019-07-18 12.24.46.395160_honeycrisp.txt
Directory: ..\food\fruits\oranges
File: 2019-07-18 12.24.46.398151_mandarin.txt
Directory: ..\food\vegetables
File: 2019-07-18 12.24.46.402496_carrot.txt
5. Use Python to print the new file system directory names with the last-modified
timestamp prepended to it's own text file by entering this command directly in
your PowerShell terminal: python3 list-directory-contents.py > food-directory-
last-modified.txt
Hope you learned a few fun things about using Python scripts for automating basic
systems administration tasks. There is, of course, a ton more to know, but we hope this
got you started on the right foot. We've shared a few additional resources to continue
learning below.
Additional resources
Python Docs: File and Directory Access : Python documentation about working
with file systems and using modules for reading the properties of files,
manipulating paths in a portable way, and creating temporary files.
Learn Python: String_Formatting tutorial : More about using the "%" operator for
string formatting.
10 Python File System Methods You Should Know : Medium article about
manipulating files and folders With os and shutil .
The Hitchhikers Guide to Python: Systems Administration : An "opinionated
guide" that offers overviews and best practices on topics related to Python. This
section covers System Admin tools and frameworks. This guide is hosted on
GitHub so you can file issues and make contributions.
Frequently Asked Questions about
using Python on Windows
FAQ
A common cause for trouble is trying to install into a location that you do not have
permission to modify. For example, the default install location might require
Administrative privileges, but by default Python will not have them. The best solution is
to create a virtual environment and install there.
Some packages include native code that requires a C or C++ compiler to install. In
general, package developers should publish pre-compiled versions, but often do not.
Some of these packages might work if you install Build Tools for Visual Studio and
select the C++ option, however in most cases you will need to contact the package
developer.
Bash
Bash
*Further discussion in the WSL product repo on GitHub . Thanks to our user community
for contributing this issue to the docs.
What is py.exe?
You may end up with multiple versions of Python installed on your machine because you
are working on different types of Python projects. Because these all use the python
command, it may not be obvious which version of Python you are using. As a standard,
it is recommended to use the python3 command (or python3.7 to select a specific
version).
The py.exe launcher will automatically select the most recent version of Python you've
installed. You can also use commands like py -3.7 to select a particular version, or py -
-list to see which versions can be used. HOWEVER, the py.exe launcher will only work
if you are using a version of Python installed from python.org . When you install
Python from the Microsoft Store, the py command is not included. For Linux, macOS,
WSL and the Microsoft Store version of Python, you should use the python3 (or
python3.7 ) command.
If you install Python using the installers from python.org and select the "add to PATH"
option, the new python command will take priority over the shortcut. Note that other
installers may add python at a lower priority than the built-in shortcut.
You can disable the shortcuts without installing Python by opening "Manage app
execution aliases" from Start, finding the "App Installer" Python entries and switching
them to "Off".
To paste a path as a string in Python, add the r prefix. This indicates that it is a raw
string, and no escape characters will be used except for \” (you might need to remove
the last backslash in your path). So your path might look like:
r"C:\Users\MyName\Documents\Document.txt"
When working with paths in Python, we recommend using the standard pathlib module.
This will let you convert the string to a rich Path object that can do path manipulations
consistently whether it uses forward slashes or backslashes, making your code work
better across different operating systems.
What is PYTHONPATH?
The PYTHONPATH environment variable is used by Python to specify a list of directories
that modules can be imported from. When running, you can inspect the sys.path
variable to see which directories will be searched when you import something.
To set this variable from the Command Prompt, use: set PYTHONPATH=list;of;paths .
Azure Kubernetes Service (AKS) enables you to deploy and manage containerized
applications while scaling resources on demand.
You can also learn about using Windows Subsystem for Android™️to update and test
your Android application so that it will run on a Windows 11 device using the Amazon
Appstore. Learn more.
Native Android
.NET MAUI
React Native
PWA with Cordova or Ionic
C/C++ for game development
*If you have been using Xamarin for cross-platform apps, see Migrate from Xamarin to
.NET MAUI.
Native Android
Native Android development on Windows means that your app is targeting only
Android (not iOS or Windows devices). You can use Android Studio or Visual Studio
to develop within the ecosystem designed specifically for the Android operating system.
Performance will be optimized for Android devices, the user-interface look and feel will
be consistent with other native apps on the device, and any features or capabilities of
the user's device will be straight-forward to access and utilize. Developing your app in a
native format will help it to just 'feel right' because it follows all of the interaction
patterns and user experience standards established specifically for Android devices.
Cross-platform
Cross-platform frameworks provide a single codebase that can (mostly) be shared
between Android, iOS, and Windows devices. Using a cross-platform framework can
help your app to maintain the same look, feel, and experience across device platforms,
as well as benefiting from the automatic rollout of updates and fixes. Instead of needing
to understand a variety of device-specific code languages, the app is developed in a
shared codebase, typically in one language.
While cross-platform frameworks aim to look and feel as close to native apps as
possible, they will never be as seamlessly integrated as a natively developed app and
may suffer from reduced speed and degraded performance. Additionally, the tools used
to build cross-platform apps may not have all of the features offered by each different
device platform, potentially requiring workarounds.
A codebase is typically made up of UI code, for creating the user interface like pages,
buttons controls, labels, lists, etc., and logic code, for calling web services, accessing a
database, invoking hardware capabilities and managing state. On average, 90% of this
can be reused, though there is typically some need to customize code for each device
platform. This generalization largely depends on the type of app you're building, but
provides a bit of context that hopefully will help with your decision-making.
A cross-platform framework for creating native mobile and desktop apps with C#
and XAML.
Develop apps that can run on Android, iOS, macOS, and Windows from a single
shared code-base, with deep access to every aspect of each native platform from a
single unified API that enables a write-once, run-anywhere dev experience.
Share UI layout and design across platforms.
An open-source evolution of Xamarin.Forms, extended from mobile to desktop
scenarios, with UI controls rebuilt for performance and extensibility.
Migrate Xamarin.Android projects to .NET MAUI
React Native
UI code: JavaScript
Logic code: JavaScript
The goal of React Native isn't to write the code once and run it on any platform,
rather to learn-once (the React way) and write-anywhere.
The community has added tools such as Expo and Create React Native App to help
those wanting to build apps without using Xcode or Android Studio.
Similar to .NET MAUI (C#), React Native (JavaScript) calls native UI elements
(without the need for writing Java/Kotlin or Swift).
Game development
Game development for Android is often unique from developing a standard Android
app since games typically use custom rendering logic, often written in OpenGL or
Vulkan. For this reason, and because of the many C libraries available that support game
development, it's common for developers to use C/C++ with Visual Studio, along with
the Android Native Development Kit (NDK), to create games for Android. Get started
with C/C++ for game development.
For more guidance on developing Android games, see the Android Developer site:
Game development basics . You will find guidance on using a game engine (like Unity,
Unreal, Defold, Godot), as well as using IDEs (like Android Studio or Visual Studio).
Next steps
Get started with native Android development on Windows
Get started with Windows Subsystem for Android
Get started developing for Android using .NET MAUI
Get started developing for Android using React Native
Get started developing a PWA for Android
Develop Dual-screen apps for Android and get the Surface Duo device SDK
Enable Virtualization support to improve emulator performance
Windows Subsystem for Android™️
Article • 03/05/2024
) Important
This guide can help you test and debug your Android app on Windows:
Preview Program
The Windows Subsystem for Android™️Preview Program allows users to receive early-
preview builds of the Windows Subsystem for Android™ and Amazon Appstore on
Windows. For more details, visit the Preview Program page.
Prerequisites
Windows Subsystem for Android™️is available on Windows 11. Your device must meet
specific requirements: Device requirements .
1. Install the Amazon Appstore from the Microsoft Store . Selecting Get will begin
the installation of the app.
2. Install an Android app from the Microsoft Store for the first time, which will also
install the Amazon Appstore.
The Amazon Appstore app will then appear in the Windows 11 Start menu and be
available on search, offering a catalogue of Android apps. The Windows Subsystem for
Android™️app, which lets you control mobile app settings and features, will also appear
in the Start menu.
7 Note
1. Launch an Android app that was installed using the Amazon Appstore.
2. You can connect using adb connect with the following command (you must have
adb installed ):
PowerShell
1. On the test device (where Windows Subsystem for Android™️is installed) open a
PowerShell window and identify the IP address of the test device by running the
command:
PowerShell
ipconfig
2. Using the debugging device terminal where Android Studio and the Android SDK
is installed (Mac/Windows), enter the command:
Console
The <TEST DEVICE IP ADDRESS> can be found in the output of "ipconfig" from the test
device. You can also deploy and debug apps from Android Studio.
To use Android Debug Bridge (ADB) to connect your development workstation directly
to your Android device so you can install packages and evaluate changes, see Android
Debug Bridge in the Android Open Source Project docs .
1. Follow the steps to connect to the Windows Subsystem for Android™️VM above.
2. Install the APK using the adb install command: adb install app-debug.apk
Expected Output:
PowerShell
Performing Streamed Install
Success
Keyboard input
For text input fields handled by an on-screen virtual keyboard input method (or IME),
such as EditText , apps should behave as expected. (EditText class in the Android
docs ).
For keystrokes that cannot be anticipated by the framework, apps will need to handle
the behavior themselves. If this is already implemented in-app, no extra work is
required.
As an example, some games may already support movement facilitated via keyboard,
through w a s d keys, alongside touch input.
The following are keyboard inputs that developers should consider code updates for
when building for Windows 11 devices:
Enter Key
Arrow-key and Tab-key Navigation
Change Selected Item Highlight Color
Ctrl-based Shortcuts
Learn more about how to optimize for these keyboard input scenarios on desktop
devices by following the Android documentation:
Mouse input
Developers should consider updating code for the following mouse inputs when
building for Windows devices:
Right Click
Tooltips / Hover Text
Hover Effects
Mouse Scroll Wheel Action
Drag and Drop
Mouse input, similar to keyboard input, must follow the official Android app guidelines.
This means using the InputDevice class paired with the SOURCE_MOUSE constant. Learn
more about how to optimize for these mouse input scenarios on desktop devices by
following the Android documentation:
Learn more about how to optimize for window resizing scenarios on desktop devices by
following the Window Management guide in the Android docs .
See the Android documentation for a description of the lifecycle events. More often
than not, you’ll want to use the onStop event and not the onPause or onUserLeaveHint
events. In fact, many multi-window Android implementations do not deliver the
onUserLeaveHint notification, and thus any business critical logic that might be in that
event handler will not be called on these platforms, including Windows Subsystem for
Android™️.
VM lifecycle considerations
Windows Subsystem for Android™️utilizes a virtual machine (VM) which provides
compatibility with the AOSP framework and devices like keyboards, mice, touch, pen,
etc.
There are three possible states for the VM running apps with Windows Subsystem for
Android™️:
1. Running
2. Lightweight Doze: Activated after no app activity for 3 minutes. Deactivated by
user activity or an app notification.
3. Not Running: Activated after no app activity for 7 minutes.
Transitions between these states are triggered by user activity, such as launching or
interaction with the Android app or an app notification. Android apps are paused and
then stopped when their window is minimized.
VM Properties
The properties for the Windows Subsystem for Android™️VM are listed below.
Hardcoding these values is not recommended as that could cause future
incompatibilities.
ノ Expand table
Property Value
Build.VERSION.SDK_INT 33
Build.BOARD windows
Android apps can also manually redirect to Windows apps using custom URI schemes.
Set the intent action to com.microsoft.windows.LAUNCH_URI and add a string extra to the
intent named com.microsoft.windows.EXTRA_URI with the custom URI as the value. For
example, to launch the Windows Calculator app from an Android app (Java):
Java
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
// Not running in Windows Subsystem for Android™️(or running on an older
build that did not contain this feature).
}
Security
Both Windows kernel-mode drivers and Windows applications running at medium
integrity level (IL) can inspect arbitrary Android containers and Android app memory.
There are no plans to add detection for cheats/macro/bot/suspicious behaviors
detection in the short-term.
Developers querying getSecurityLevel will get SECURITY_LEVEL_SW_SECURE_CRYPTO . Learn
more about getSecurityLevel in the Android API Reference guide .
Uninstalling the Amazon Appstore will uninstall the Windows Subsystem for
Android™️and all other Android apps.
Uninstalling an Amazon Appstore app will only uninstall the app (same behavior as
Windows apps).
Uninstalling the Windows Subsystem for Android™️will uninstall the Amazon
Appstore and all Android apps.
Troubleshooting issues
If you encounter issues specific to the Amazon Appstore on Windows, try the following
troubleshooting steps:
For further troubleshooting steps relating to the Windows Subsystem for Android™️
Settings app or to leave feedback using Feedback Hub, see Troubleshooting and FAQ for
mobile apps on Windows .
For any other developer questions and support, use the Windows Subsystem for
Android™️tag on Microsoft Q&A.
Additional resources
Apps from the Amazon Appstore
Accessibility on Windows Subsystem for Android™️
6 Collaborate with us on Windows developer
GitHub feedback
The source for this content can Windows developer is an open
be found on GitHub, where you source project. Select a link to
can also create and review provide feedback:
issues and pull requests. For
more information, see our Open a documentation issue
contributor guide.
Provide product feedback
Release Notes for Windows Subsystem
for Android™️
Article • 03/05/2024
) Important
These release notes are based on updates to the Windows Subsystem for Android™️. For
basic information on how to install and run Android™️apps on Windows, see the
Support article: Installing the Amazon Appstore and Android™️Apps .
Build 2304.40000.3.0
June 1, 2023
Package verification for apps on WSA: Android apps are scanned using anti-virus
software installed on Windows prior to app installation.
Ability for users to configure how much memory to assign to Android
Android apps will be launched when a user opens the supported app link from any
app (Android AppLink support)
Linux kernel updated to 5.15.94
Improvements to platform reliability and performance
Build 2303.40000.3.0
April 11, 2023
Build 2302.4000
March 15, 2023
Build 2301.40000.4.0
February 9, 2023
Build 2211.40000.11.0
January 10, 2023
Build 2210.40000.7.0
November 17, 2022
Enhancement of audio recording quality
Enhancement of OAuth scenarios
Support for MPEG2 decoding
Improvements to the camera experience when the device is not equipped with a
camera
Improvements in input reliability
Chromium update to 106
Build 2209.40000.26.0
October 20, 2022
Build 2208.40000.4.0
September 15, 2022
Build 2207.40000.8.0
August 31, 2022
New compatibility shim to allow apps to maintain aspect ratio but still support
resize
Accessibility improvements to the Windows Subsystem for Android Settings app
New compatibility shims in the Windows Subsystem for Android Settings app
Fixed problems with restarting apps
Apps that update toast notifications instead of using progress toasts have better
behavior
Game controls user education dialog for apps with compatibility shims enabled
Improvements with handling VPN
Scrollbar fix for Windows Subsystem for Android Settings compatibility page
User crash data and system app crash data is now being reported
“No internet available” toast notification is now suppressed
Custom Android toasts now render correctly
Amazon Appstore 60.09 update
Android security update
Improved reliability
Build 2206.40000.15.0
August 2, 2022
New suite of shims available to toggle in the Windows Subsystem for Android
Settings app which enables better experiences in several apps
Compatibility for games with joysticks (mapped to WASD)
Compatibility for gamepad in games
Compatibility for aiming in games with arrow keys
Compatibility for sliding in games with arrow keys
Scrolling improvements
Networking improvements
Android minimum window size defaulted to 220dp
Improved dialog when unsupported VPN is detected
New toggle to view/save diagnostic data in the Windows Subsystem for Android
Settings app
Security updates
General reliability fixes, including improvements to diagnostic sizes
Graphics improvements
Build 2205.40000.14.0
July 6, 2022
Known Issues:
Some VPNs may not work with Advanced Networking. If you use a VPN and find
Android apps do not have network connectivity, please disable Advanced
Networking in the Windows Subsystem for Android Settings app
Build 2204.40000.19.0
May 20, 2022
Known Issues:
Build 2203.40000.3.0
March 22, 2022.
Known Issues:
Known Issues:
) Important
The Windows Subsystem for Android™️Preview Program allows users to receive early-
preview builds of the Windows Subsystem for Android™ and Amazon Appstore on
Windows. Installing the Amazon Appstore on Windows automatically installs Windows
Subsystem for Android™️. Learn more about installing the Amazon Appstore .
7 Note
This program is separate from the Windows Insider Program and only enrolls your
account into receiving preview builds of Windows Subsystem for Android™️.
Preview builds may not always be stable and users may encounter issues that block apps
or require workarounds. Visit Troubleshooting and FAQ for mobile apps on Windows
to find help and information on how to leave feedback using Windows Feedback Hub.
Your feedback will be useful in improving the quality of Windows Subsystem for
Android™️.
Please note that the Windows Subsystem for Android™ may be substantially modified
before it’s public release. Microsoft makes no warranties, express or implied, with
respect to the information provided here. Microsoft respects your privacy:
Prerequisites
Windows Subsystem for Android™️is available on Windows 11.
Your device must meet specific requirements. Install mobile apps and the Amazon
Appstore: Device requirements .
You must have the Amazon Appstore installed on your Windows 11 device to
participate in the preview. An Amazon account is also required to download
mobile apps from the Amazon Appstore.
Windows Subsystem for Android™️is currently available in select countries and
regions .
Sign Up
You will need a Microsoft Account (MSA) email address that you use to sign in to the
Microsoft Store. If you do not yet have a Microsoft Account, create an account here .
Once you submit your MSA email, you will see a confirmation that you have joined the
program and receive a confirmation email. You will be added to a special app flight ring
to receive Windows Subsystem for Android™️preview updates. These updates will be
pushed to the Amazon Appstore that you previously installed via the Microsoft Store
(see prerequisites). This may take up to 7 days before you begin receiving updates.
Opt Out
If you have previously joined the program and would like to stop receiving preview
builds, you can opt out using the form linked below. After opting out of the program,
you will receive a confirmation email. It may take up to 7 days before you are no longer
in the preview program and return to receiving the general public builds. Opting out of
this program will not opt your account out of the Windows Insider Program.
This guide will get you started using Windows to create native Android applications. If
you would prefer a cross-platform solution, see Overview of Android development on
Windows for a brief summary of some options.
The most straight-forward way to create a native Android app is using Android Studio
with either Java or Kotlin, though it is also possible to use C or C++ for Android
development if you have a specific purpose. The Android Studio SDK tools compile your
code, data, and resource files into an archive Android package, .apk file. One APK file
contains all the contents of an Android app and is the file that Android-powered devices
use to install the app.
Follow the setup wizard in Android Studio and install any SDK packages that it
recommends. As new tools and other APIs become available, Android Studio will notify
you with a pop-up, or check for updates by selecting Help > Check for Update.
In the Choose your project window, you will be able to choose between these
templates:
Basic Activity: Creates a simple app with an app bar, a floating action button and
two layout files: one for the activity and one to separate out text content.
Empty Activity: Creates an empty activity and a single layout file with sample text
content.
Templates are commonly used to add activities to new and existing app modules.
For example, to create a login screen for your app's users, add an activity with the
Login Activity template. To learn more about selecting an activity and how to add
code from a template, see Android Developer guide by Google.
7 Note
The Android operating system is based on the idea of components and uses the
terms activity and intent to define interactions. An activity represents a single,
focused task that a user can do. An activity provides a window for building the user
interface using classes based on the View class. There is a lifecycle for activities in
the Android operating system, defined by six callbacks: onCreate() , onStart() ,
onResume() , onPause() , onStop() , and onDestroy() . The activity components
interact with one another using intent objects. Intent either defines the activity to
start or describes the type of action to perform (and the system selects the
appropriate activity for you, which can even be from a different application). Learn
more about Activities, the Activity Lifecycle, and Intents in the Android Developer
guide by Google.
Java or Kotlin
Java became a language in 1991, developed by what was then Sun Microsystems, but
which is now owned by Oracle. It has become one of the most popular and powerful
programming languages with one of the largest support communities in the world. Java
is class-based and object-oriented, designed to have as few implementation
dependencies as possible. The syntax is similar to C and C++, but it has fewer low-level
facilities than either of them.
Kotlin was first announced as a new open-source language by JetBrains in 2011 and has
been included as an alternative to Java in Android Studio since 2017. In May 2019,
Google announced Kotlin as it's preferred language for Android app developers, so
despite being a newer language, it also has a strong support community and has been
identified as one of the fastest growing programming languages. Kotlin is cross-
platform, statically typed, and designed to interoperate fully with Java.
Java is more widely used for a broader range of applications and offers some features
that Kotlin does not, such as checked exceptions, primitive types that are not classes,
static members, non-private fields, wildcard-types, and ternary-operators. Kotlin is
specifically designed for and recommended by Android. It also offers some features that
Java does not, such as null references controlled by the type system, no raw types,
invariant arrays, proper function types (as opposed to Java's SAM-conversions), use-site
variance without wildcards, smart casts, and more. Find a more in-depth look at the
comparison to Java in the Kotlin documentation .
Select the Help me choose link to open a comparison chart showing the device support
distribution and key features associated with the platform version release.
AndroidX artifacts represents the new version of the Android support library and
provides backwards-compatibility across Android releases. AndroidX provides a
consistent namespace starting with the string androidx for all available packages.
7 Note
AndroidX is now the default library. To uncheck this box and use the previous
support library requires removing the lastest Android Q SDK. See Uncheck use
Androidx artifacts on StackOverflow for instructions, but first note that the
former Support Library packages have been mapped into corresponding androidx.*
packages. For a full mapping of all the old classes and build artifacts to the new
ones, see Migrating to AndroidX .
Project files
The Android Studio Project window, contains the following files (be sure that the
Android view is selected from the drop-down menu):
The main activity and entry point for your app. When you build and run your app, the
system launches an instance of this Activity and loads its layout.
The XML file defining the layout for the activity's user interface (UI). It contains a
TextView element with the text "Hello World"
The manifest file describing the fundamental characteristics of the app and each of its
components.
In the Choose your project section of the Android Studio wizard, select the Native
C++* project type. Select Next, complete the remaining fields, then select Next
again.
In the Customize C++ Support section of the wizard, you can customize your
project with the C++ Standard field. Use the drop-down list to select which
standardization of C++ you want to use. Selecting Toolchain Default uses the
default CMake setting. Select Finish.
Once Android Studio creates your new project, you can find a cpp folder in the
Project pane that contains the native source files, headers, build scripts for CMake
or ndk-build, and prebuilt libraries that are a part of your project. You can also find
a sample C++ source file, native-lib.cpp , in the src/main/cpp/ folder which
provides a simple stringFromJNI() function returning the string "Hello from C++".
Additionally, you should see a CMake build script, CMakeLists.txt , in your
module's root directory required for building your native library.
To learn more, about adding C and C++ code to your project, see the Android
developer guide . To find Android NDK samples with C++ integration, see the Android
NDK samples repo on GitHub. To compile and run a C++ game on Android, use the
Google Play Game services API .
Design guidelines
Device users expect applications to look and behave a certain way... whether swiping or
tapping or using voice-controls, users will hold specific expectations for what your
application should look like and how to use it. These expectations should remain
consistent in order to reduce confusion and frustration. Android offers a guide to these
platform and device expectations that combines the Google Material Design foundation
for visual and navigational patterns, along with quality guidelines for compatibility,
performance, and security.
Fluent Design System for Android design and build custom apps that are natively
Android while still uniquely Fluent.
Sketch toolkit
Figma toolkit
Android font
Android User Interface Guidelines
Guidelines for Android app icons
Additional resources
Android Application Fundamentals
Develop Dual-screen apps for Android and get the Surface Duo device SDK
This guide will help you to get started using React Native on Windows to create a cross-
platform app that will work on Android devices.
Overview
React Native is an open-source mobile application framework created by Facebook. It
is used to develop applications for Android, iOS, Web and UWP (Windows) providing
native UI controls and full access to the native platform. Working with React Native
requires an understanding of JavaScript fundamentals.
2. Install Android Studio for Windows . Android Studio installs the latest Android
SDK by default. React Native requires Android 6.0 (Marshmallow) SDK or later. We
recommend using the latest SDK.
3. Create environment variable paths for the Java SDK and Android SDK:
In the Windows search menu, enter: "Edit the system environment variables",
this will open the System Properties window.
Choose Environment Variables... and then choose New... under User
variables.
Enter the Variable name and value (path). The default paths for the Java and
Android SDKs are as follows. If you've chosen a specific location to install the
Java and Android SDKs, be sure to update the variable paths accordingly.
JAVA_HOME: C:\Program Files\Android\Android Studio\jre\bin
ANDROID_HOME: C:\Users\username\AppData\Local\Android\Sdk
4. Install NodeJS for Windows You may want to consider using Node Version
Manager (nvm) for Windows if you will be working with multiple projects and
version of NodeJS. We recommend installing the latest LTS version for new
projects.
7 Note
You may also want to consider installing and using the Windows Terminal for
working with your preferred command-line interface (CLI), as well as, Git for
version control . The Java JDK comes packaged with Android Studio v2.2+, but
if you need to update your JDK separately from Android Studio, use the Windows
x64 Installer .
PowerShell
If you want to start a new project with a specific React Native version, you can use
the --version argument. For information about versions of React Native, see
Versions - React Native .
PowerShell
PowerShell
cd MyReactNativeApp
3. If you want to run your project on a hardware Android device, connect the device
to your computer with a USB cable.
4. If you want to run your project on an Android emulator, you shouldn't need to
take any action as Android Studio installs with a default emulator installed. If you
want to run your app on the emulator for a particular device. Click on the AVD
Manager button in the toolbar.
5. To run your project, enter the following command. This will open a new console
window displaying Node Metro Bundler.
PowerShell
If you are using a new install of Android Studio and haven't yet done any
other Android development, you may get errors at the command line when
you run the app about accepting licenses for the Android SDK. Such as
"Warning: License for package Android SDK Platform 29 not accepted." To
resolve this, you can click the SDK Manager button in Android Studio .
Or, you can list and accept the licenses with the following command, making
sure to use the path to the SDK location on your machine.
PowerShell
C:\Users\[User Name]\AppData\Local\Android\Sdk\tools\bin\sdkmanager --
licenses
6. To modify the app, open the MyReactNativeApp project directory in the IDE of your
choice. We recommend VS Code or Android Studio.
7. The project template created by react-native init uses a main page named
App.js . This page is pre-populated with a lot of useful links to information about
React Native development. Add some text to the first Text element, like the "HELLO
WORLD!" string shown below.
JavaScript
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits. HELLO WORLD!
</Text>
8. Reload the app to show the changes you made. There are several ways to do this.
This guide will help you to get started creating a hybrid web app or Progressive Web
App (PWA) on Windows using a single HTML/CSS/JavaScript codebase that can be used
on the web and across device platforms (Android, iOS, Windows).
By using the right frameworks and components, web-based applications can work on an
Android device in a way that looks to users very similar to a native app.
Hybrid web apps: Code (HTML, JS, CSS) is packaged in an APK and can be
distributed via the Google Play Store. The viewing engine is isolated from the
users' internet browser, no session or cache sharing.
Progressive Web Apps (PWAs): Code (HTML, JS, CSS) lives on the web and doesn't
need to be packaged as an APK. Resources are downloaded and updated as
needed using a Service Worker. The Chrome browser will render and display your
app, but will look native and not include the normal browser address bar, etc. You
can share storage, cache, and sessions with the browser. This is basically like
installing a shortcut to the Chrome browser in a special mode. PWAs can also be
listed in the Google Play Store using Trusted Web Activity.
PWAs and hybrid web apps are very similar to a native Android app in that they:
Can be installed via the App Store (Google Play Store and/or Microsoft Store)
Have access to native device features like camera, GPS, Bluetooth, notifications,
and list of contacts
Work Offline (no internet connection)
Can be installed on the Android home screen directly from the web (without an
App Store)
Can additionally be installed via the Google Play Store using a Trusted Web
Activity
Can be discovered via web search or shared via a URL link
Rely on a Service Worker to avoid the need to package native code
You don't need a framework to create a Hybrid app or PWA, but there are a few popular
frameworks that will be covered in this guide, including PhoneGap (with Cordova) and
Ionic (with Cordova or Capacitor using Angular or React).
Apache Cordova
Apache Cordova is an open-source framework that can simplify the communication
between your JavaScript code living in a native WebView and the native Android
platform by using plugins . These plugins expose JavaScript endpoints that can be
called from your code and used to call native Android device APIs. Some example
Cordova plugins include access to device services like battery status, file access,
vibration / ring tones, etc. These features are not typically available to web apps or
browsers.
Ionic
Ionic
Ionic is a framework that adjusts the user interface (UI) of your app to match the
design language of each platform (Android, iOS, Windows). Ionic enables you to use
either Angular or React .
7 Note
VS Code for writing your code. Download VS Code for Windows . You may also
want to install the WSL Remote Extension if you prefer to build your app with a
Linux command line.
Windows Terminal for working with your preferred command-line interface (CLI).
Install Windows Terminal from Microsoft Store .
Bash
Create an Ionic Angular app using the "Tabs" app template by entering the command:
Bash
Bash
cd photo-gallery
Bash
ionic serve
For more information, see the Ionic Cordova Angular docs . Visit the Making your
Angular app a PWA section of the Ionic docs to learn how to move your app from
being a hybrid to a PWA.
Bash
Create an Ionic Angular app using the "Tabs" app template and adding Capacitor by
entering the command:
Bash
Bash
cd photo-gallery
Bash
TypeScript
// Call the element loader after the platform has been bootstrapped
defineCustomElements(window);
ionic serve
For more information, see the Ionic Capacitor Angular docs . Visit the Making your
Angular app a PWA section of the Ionic docs to learn how to move your app from
being a hybrid to a PWA.
Bash
Bash
Bash
cd myApp
Bash
ionic serve
For more information, see the Ionic React docs . Visit the Making your React app a
PWA section of the Ionic docs to learn how to move your app from being a hybrid to
a PWA.
1. Install the required components -- Java Development Kit (JDK), Gradle, and the
Android SDK .
2. Create an Android Virtual Device (AVD): See the [Android developer guide]]
(https://developer.android.com/studio/run/managing-avds.html ).
3. Enter the command for Ionic to build and deploy your app to the emulator: ionic
cordova emulate [<platform>] [options] . In this case, the command should be:
Bash
See the Cordova Emulator in the Ionic docs for more info.
Additional resources
Develop Dual-screen apps for Android and get the Surface Duo device SDK
This guide covers how to set up exclusions in your Microsoft Defender security settings
in order to improve your build times when developing Android apps using a Windows
machine.
However, Microsoft Defender's real-time protection will also dramatically slow file
system access and build speed when developing Android apps.
During the Android build process, many files are created on your computer. With
antivirus real-time scanning enabled, the build process will halt each time a new file is
created while the antivirus scans that file.
Fortunately, Microsoft Defender has the capability to exclude files, project directories, or
file types that you know to be secure from it's antivirus scanning process.
2 Warning
To ensure that your computer is safe from malicious software, you should not
completely disable real-time scanning or your Microsoft Defender antivirus
software. Defining exclusions lowers the protection offered by Defender. You
should always evaluate the risks that are associated with implementing exclusions,
and only exclude files that you are confident are not malicious.
Microsoft Defender Antivirus interprets user environment variables in the context of the
system user, using the LocalSystem account, which means it gets information from the
system environment variable, and not from the user environment variable. See Using
incorrect environment variables as wildcards in the file name and folder path or
extension exclusion lists. You can find a list of System environment variables in the
Microsoft Defender for Endpoint documentation. You can also Use wildcards in the file
name and folder path or extension exclusion lists. This explains the use of the asterisk * ,
question mark ? , or environment variables (such as %ALLUSERSPROFILE% ) as wildcards
when defining items in the file name or folder path exclusion list. The way these
wildcards are interpreted differs from their usual usage in other apps and languages.
Please remember that adding exclusions lowers the protection offered by Defender. You
should always evaluate the risks that are associated with implementing exclusions, and
only exclude files that you are confident are not malicious.
7 Note
Daniel Knoodle has set up a GitHub repo with recommended scripts to add
Microsoft Defender exclusions for Visual Studio 2017 .
There are several ways to test and debug your Android application using a real device or
emulator on your Windows machine. We have outlined a few recommendations in this
guide.
1. Connect your device to your Windows development machine with a USB cable. You
may receive a notification to install a USB driver.
2. Open the Settings screen on your Android device.
3. Select About phone.
4. Scroll to the bottom and tap Build number seven times, until You are now a
developer! is visible.
5. Return to the previous screen, select System.
6. Select Advanced, scroll to the bottom, and tap Developer options.
7. In the Developer options window, scroll down to find and enable USB debugging.
3. Select Run ▷. This will launch the app on your connected device.
1. Verify that your computer hardware and software is compatible with Hyper-V by
opening a command prompt and entering the command: systeminfo
2. In the Windows search box (lower left), enter "windows features". Select Turn
Windows features on or off from the search results.
3. Once the Windows Features list appears, scroll to find Hyper-V (includes both
Management Tools and Platform) and Windows Hypervisor Platform, ensure that
the box is checked to enable both, then select OK.
1. In the Android Studio toolbar, select your app from the run configurations drop-
down menu.
2. From the target device drop-down menu, select the device that you want to run
your app on.
3. Select Run ▷. This will launch the Android Emulator .
Tip
Once your app is installed on the emulator device, you can use Apply Changes to
deploy certain code and resource changes without building a new APK. See the
Android developer guide for more information.
Additional resources
Develop Dual-screen apps for Android and get the Surface Duo device SDK
Add Windows Defender exclusions to improve performance
DOWNLOAD OVERVIEW
Install Visual Studio and choose Welcome to C++ in Visual
your C++ workloads Studio
Learn to use the Visual Studio IDE Write C++ and C apps in Visual Studio
e Start a guided tour of Visual Studio g Create a console calculator app
g Open code from a repo g Create a Windows Desktop app with Win32
g Write and edit code g Create a Windows Desktop app with MFC
g Build your code g Create a Windows DLL
g Debug your code g Create a static library
g Test your code g Create a .NET component
g Create a Universal Windows Platform app
Use the command-line tools Use C++ and C in Visual Studio Code
g Compile C++ code g Get started with Visual Studio Code
g Compile C code g Install the Microsoft C/C++ extension
g Compile C++/CX g Use Microsoft C/C++ in Windows
g Compile C++/CLI g Use C++ in the Windows Subsystem for Linux
g Use C++ on Linux
g Use C++ on macOS
C++ C
Microsoft Learn Q&A - C++ Team Blog - Twitter - Developer Community - Stack Overflow - How to report an
issue - Suggest a feature - Contribute to C++ docs: Read our contributor guide.
C# language documentation
The C# guide contains articles, tutorials, and code samples to help you get started with C# and
the .NET platform. Experienced developers can learn about new features in the What's new
section. Experienced developers can learn details of language behavior from the reference and
language specifications.
C# reference
Read C# language reference material, and the C# language specifications. The C# reference provides an
informative reference for the C# language. The C# language specification is the normative reference for
the C# language. It's the official source for C# language syntax and semantics. Feature specifications
document features not yet incorporated in the standard.
Are you interested in contributing to the .NET docs? For more information, see our contributor guide.
F# documentation
Learn how to write any application using the F# programming language on .NET.
Learn to program in F#
b GET STARTED
What is F#?
F# strategy
First steps in F#
Install F#
Further learning
q VIDEO
a DOWNLOAD
F# language guide
e OVERVIEW
F# language guide
i REFERENCE
F# language specification
F# RFCs
F# library reference
.NET library reference
F# fundamentals
e OVERVIEW
Overview
Tour of F#
Values
p CONCEPT
Functional concepts
Type providers
g TUTORIAL
Using Functions
Pattern matching
Object programming
Async programming
F# in practice
e OVERVIEW
d TRAINING
F# style guide
F# tools
e OVERVIEW
F# Interactive
F# development tools
F# notebooks
F# for JavaScript
New features in F#
h WHAT'S NEW
What's new in F# 8
What's new in F# 7
What's new in F# 6
What's new in F# 5
g TUTORIAL
Explore tasks
Using containers for remote development and deploying applications with the Docker
platform is a very popular solution with many benefits. Learn more about the variety of
support offered by Microsoft tools and services, including Windows Subsystem for Linux
(WSL), Visual Studio, Visual Studio Code, .NET, and a broad variety of Azure services.
Docker on Windows
Containers on Windows
Containers on Windows docs
Package apps with their dependencies and leverage operating system-level
virtualization for fast, fully isolated environments on a single system. Learn about
Windows containers, including quick starts, deployment guides, and samples.
Community Resources
Connect with other PowerShell users
PowerShell Tech
User Groups DSC Community
Community
Digital Art
PowerShell Team
Communicate with the PowerShell team
Overview
e OVERVIEW
What is Rust?
c HOW-TO GUIDE
Tutorials
g TUTORIAL
Additional resources
d TRAINING
It's not hard to get started with Rust . If you're a beginner who's interested in learning
Rust using Windows, then we recommend that you follow each detail of this step-by-
step guide. It shows you what to install, and how to set up your development
evironment.
Tip
If you're already sold on Rust and you have your Rust environment already set up,
and you just want to start calling Windows APIs, then feel free to jump forward to
the Rust for Windows, and the windows crate topic.
What is Rust?
Rust is a systems programming language, so it's used for writing systems (such as
operating systems). But it can also be used for applications where performance and
trustworthiness are important. The Rust language syntax is comparable to that of C++,
provides performance on par with modern C++, and for many experienced developers
Rust hits all the right notes when it comes to compilation and runtime model, type
system, and deterministic finalization.
In addition, Rust is designed around the promise of guaranteed memory safety, without
the need for garbage collection.
So why did we choose Rust for the latest language projection for Windows? One factor
is that Stack Overflow's annual developer survey shows Rust to be the best-loved
programming language by far, year after year. While you might find that the language
has a steep learning curve, once you're over the hump it's hard not to fall in love.
A crate is a Rust unit of compilation and linking. A crate can exist in source code
form, and from there it can be processed into a crate in the form of either a binary
executable (binary for short), or a binary library (library for short).
A Rust project is known as a package. A package contains one or more crates,
together with a Cargo.toml file that describes how to build those crates.
rustup is the installer and updater for the Rust toolchain.
Related
The Rust website
Rust for Windows, and the windows crate
Stack Overflow annual developer survey
Rust Foundation
crates.io
Set up your dev environment on Windows for Rust
Set up your dev environment on
Windows for Rust
Article • 08/02/2022
In the Overview of developing on Windows with Rust topic, we introduced Rust and
talked about what it is and what some of its main moving parts are. In this topic, we'll
set up our development environment.
We recommend that you do your Rust development on Windows. However, if you plan
to locally compile and test on Linux, then developing with Rust on the Windows
Subsystem for Linux (WSL) is also an option.
You can either download the Microsoft C++ Build Tools , or (recommended) you might
prefer just to install Microsoft Visual Studio .
) Important
Use of the Microsoft C++ Build Tools, or Visual Studio Build Tools, requires a valid
Visual Studio license (either Community, Pro, or Enterprise).
7 Note
While installing Visual Studio, there are several Windows workloads that we recommend
you select—.NET desktop development, Desktop development with C++, and
Universal Windows Platform development. You might not think that you'll need all
three, but it's likely enough that some dependency will arise where they're required that
we feel it's just simpler to select all three.
New Rust projects default to using Git. So also add the individual component Git for
Windows to the mix (use the search box to search for it by name).
Install Rust
Next, install Rust from the Rust website . The website detects that you're running
Windows, and it offers you 64- and 32-bit installers of the rustup tool for Windows, as
well as instructions on installing Rust to the Windows Subsystem for Linux (WSL).
Tip
Rust works very well on Windows; so there's no need for you to go the WSL route
(unless you plan to locally compile and test on Linux). Since you have Windows, we
recommend that you just run the rustup installer for 64-bit Windows. Also install
the Microsoft C and C++ (MSVC) toolchain by running rustup default stable-
msvc . You'll then be all set to write apps for Windows using Rust.
When the Rust installer is finished, you'll be ready to program with Rust. You won't have
a convenient IDE yet (we'll cover that in the next section—Install Visual Studio Code).
And you're not yet set up to call Windows APIs. But you could launch a command
prompt ( cmd.exe ), and perhaps issue the command cargo --version . If you see a
version number printed, then that confirms that Rust installed correctly.
If you're curious about the use of the cargo keyword above, Cargo is the name of the
tool in the Rust development environment that manages and builds your projects (more
properly, packages) and their dependencies.
And if you really do want to dive in to some programming at this point (even without
the convenience of an IDE), then you could read the Hello, World! chapter of The Rust
Programming Language book on the Rust website.
VS Code also contains a built-in terminal that enables you to issue command-line
arguments (to issue commands to Cargo, for example).
2. After you've installed VS Code, install the rust-analyzer extension. You can either
install the rust-analyzer extension from the Visual Studio Marketplace , or you
can open VS Code, and search for rust-analyzer in the extensions menu
(Ctrl+Shift+X).
3. For debugging support, install the CodeLLDB extension. You can either install the
CodeLLDB extension from the Visual Studio Marketplace , or you can open VS
Code, and search for CodeLLDB in the extensions menu (Ctrl+Shift+X).
7 Note
You can either install the C/C++ extension from the Visual Studio
Marketplace , or you can open VS Code, and search for C/C++ in the
extensions menu (Ctrl+Shift+X).
4. If you want to open the terminal in VS Code, select View > Terminal, or
alternatively use the shortcut Ctrl+` (using the backtick character). The default
terminal is PowerShell.
2. Then ask Cargo to create a new Rust project for you with the following command.
Console
The argument you pass to the cargo new command is the name of the project that
you want Cargo to create. Here, the project name is first_rust_project. The
recommendation is that you name your Rust projects using snake case (where
words are lower-case, with each space replaced by an underscore).
Cargo creates a project for you with the name that you supply. And in fact Cargo's
new projects contain the source code for a very simple app that outputs a Hello,
world! message, as we'll see. In addition to creating the first_rust_project project,
Cargo has created a folder named first_rust_project, and has put the project's
source code files in there.
3. So now cd into that folder, and then launch VS Code from within the context of
that folder.
Console
cd first_rust_project
code .
4. In VS Code's Explorer, open the src > main.rs file, which is the Rust source code
file that contains your app's entry point (a function named main). Here's what it
looks like.
Rust
// main.rs
fn main() {
println!("Hello, world!");
}
7 Note
When you open the first .rs file in VS Code, you'll get a notification saying
that some Rust components aren't installed, and asking whether you want to
install them. Click Yes, and VS Code will install the Rust language server.
You can tell from glancing at the code in main.rs that main is a function definition,
and that it prints the string "Hello, world!". For more details about the syntax, see
Anatomy of a Rust Program on the Rust website.
5. Now let's try running the app under the debugger. Put a breakpoint on line 2, and
click Run > Start Debugging (or press F5). There are also Debug and Run
commands embedded inside the text editor.
7 Note
When you run an app under the CodeLLDB extension and debugger for the
first time, you'll see a dialog box saying "Cannot start debugging because no
launch configuration has been provided". Click OK to see a second dialog box
saying "Cargo.toml has been detected in this workspace. Would you like to
generate launch configurations for its targets?". Click Yes. Then close the
launch.json file and begin debugging again.
6. As you can see, the debugger breaks at line 2. Press F5 to continue, and the app
runs to completion. In the Terminal pane, you'll see the expected output "Hello,
world!".
Related
Rust for Windows, and the windows crate
Windows Subsystem for Linux (WSL)
Microsoft C++ Build Tools
Microsoft Visual Studio
Visual Studio Code for Windows
rust-analyzer extension
CodeLLDB extension
C/C++ extension
Rust for Windows, and the windows
crate
Article • 08/11/2023
https://www.youtube-nocookie.com/embed/-oZrsCPKsn4
You can find all of the latest updates in the Release log of the Rust for Windows repo
on GitHub.
Rust for Windows lets you use any Windows API (past, present, and future) directly and
seamlessly via the windows crate (crate is Rust's term for a binary or a library, and/or
the source code that builds into one).
The win32metadata project aims to provide metadata for Win32 APIs. This metadata
describes the API surface—strongly-typed API signatures, parameters, and types. This
enables the entire Windows API to be projected in an automated and complete way for
consumption by Rust (as well as languages such as C# and C++). Also see Making
Win32 APIs more accessible to more languages .
As a Rust developer, you'll use Cargo (Rust's package management tool)—along with
https://crates.io (the Rust community's crate registry)—to manage the dependencies
in your projects. The good news is that you can reference the windows crate from your
Rust apps, and then immediately begin calling Windows APIs. You can also find Rust
documentation for the windows crate over on https://docs.rs .
This resource essentially documents how the Windows APIs and types are projected into
idiomatic Rust. Use it to browse or search for the APIs you need to know about, and that
you need to know how to call.
Related
Overview of developing on Windows with Rust
RSS reader tutorial
The windows crate
Documentation for the windows crate
Win32 metadata
Making Win32 APIs more accessible to more languages
Rust documentation for the Windows API
Rust for Windows
Minesweeper sample app
RSS reader tutorial (Rust for Windows
with VS Code)
Article • 05/22/2023
The previous topic introduced Rust for Windows, and the windows crate.
Now let's try out Rust for Windows by writing a simple console app that downloads the
titles of blog posts from a Really Simple Syndication (RSS) feed.
1. Launch a command prompt ( cmd.exe ), and cd to a folder where you want to keep
your Rust projects.
2. Using Cargo, create a new Rust project named rss_reader, and cd to the newly-
created folder:
Console
Console
code .
4. Let's implement the main rss_reader project. First, open the Cargo.toml file at the
root of the project. A Cargo.toml file is a text file that describes a Rust project,
including any dependencies it has.
Add a dependency on the windows crate, as shown in the listing below. The
windows crate is large. To keep build times fast, we'll select just the
Foundation_Collections and Web_Syndication features that we need for this code.
toml
# Cargo.toml
...
[dependencies.windows]
version = "0.43.0"
features = [
"Foundation_Collections",
"Web_Syndication",
]
5. Then, open the rss_reader project's src/main.rs source code file. There you'll find
the Cargo default "Hello, world!" code. Add the following use statement to the
beginning of main.rs :
Rust
// src\main.rs
use windows::{
core::*,
Foundation::Uri,
Web::Syndication::SyndicationClient
};
fn main() {
println!("Hello, world!");
}
The use declaration shortens the path to the types that we'll be using. There's the
Uri type that we mentioned earlier.
6. To create a new Uri, replace Cargo's default main function with this:
Rust
// src\main.rs
...
Ok(())
}
Notice that the return type of the main function is a Result, from windows::core::.
That will make things easier, as it's common to deal with errors from operating
system (OS) APIs. windows::core::Result helps us with error propagation, and
concise error handling.
You can see the question-mark operator at the end of the line of code. To save on
typing, we do that to use Rust's error-propagation and short-circuiting logic. That
means we don't have to do a bunch of manual error handling for this simple
example. For more info about this feature of Rust, see The ? operator for easier
error handling .
Also notice the h! macro from the windows crate. We use that to construct an
HSTRING reference from a Rust string literal. The WinRT API uses HSTRING
extensively for string values.
Rust
// src\main.rs
...
Ok(())
}
The new function is a Rust constructor. All objects in the windows crate follow the
Rust convention and name their constructors new.
Rust
// src\main.rs
...
Ok(())
}
9. Now we can iterate over the resulting items, and let's print out just the titles. You'll
also see a few extra lines of code below to set a user-agent header, since some
RSS feeds require that.
Rust
// src\main.rs
...
client.SetRequestHeader(
h!("User-Agent"),
h!("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64;
Trident/6.0)"),
)?;
Ok(())
}
10. Now let's confirm that we can build and run by clicking Run > Run Without
Debugging (or pressing Ctrl+F5). If you see any unexpected messages, then make
sure you've successfully completed the Hello, world! tutorial (Rust with VS Code).
There are also Debug and Run commands embedded inside the text editor.
Alternatively, from a command prompt in the rss_reader folder, type cargo run ,
which will build and then run the program.
Down in the VS Code Terminal pane, you can see that Cargo successfully
downloads and compiles the windows crate, caching the results, and using them
to make subsequent builds complete in less time. It then builds the sample, and
runs it, displaying a list of blog post titles.
That's as simple as it is to program Rust for Windows. Under the hood, however, a lot of
love goes into building the tooling so that Rust can both parse .winmd files based on
ECMA-335 (Common Language Infrastructure, or CLI), and also faithfully honor the
COM-based application binary interface (ABI) at run-time with both safety and efficiency
in mind.
1. Just like we did for the RSS project, at the command prompt cd to the folder with
your Rust projects.
Console
Rust
# message_box\Cargo.toml
...
[dependencies.windows]
version = "0.43.0"
features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
]
4. Now open the project's src/main.rs file, and add the use declarations with the
new namespaces (as shown below). And finally add code to call the MessageBoxA
and MessageBoxW functions. The Windows API docs are mainly written with
C/C++ in mind, so it's useful to compare the API docs to the docs for the Rust
projections in the windows crate: MessageBoxA (Rust) and MessageBoxW
(Rust) .
Rust
// src\main.rs
use windows::{
core::*,
Win32::UI::WindowsAndMessaging::*
};
fn main() {
unsafe {
MessageBoxA(None, s!("Ansi"), s!("World"), MB_OK);
MessageBoxW(None, w!("Wide"), w!("World"), MB_OK);
}
}
As you can see, we must use these Win32 APIs in an unsafe block (see Unsafe
blocks ). Also note the s! and w! macros, which create LPCSTR and LPCWSTR
arguments from Rust UTF-8 string literals; much like we created an HSTRING with
the h! macro for rss_reader. Rust is natively Unicode with UTF-8 strings, so using
the wide Unicode (W-suffix) Windows APIs is preferred over the ANSI (A-suffix)
APIs. This can be important if you use non-English text in your code.
This time when you build and run, Rust displays two Windows message boxes.
Related
Rust for Windows, and the windows crate
ECMA-335
The ? operator for easier error handling
Unsafe blocks
Visual Studio documentation
Learn how to use Visual Studio to develop applications, services, and tools in the language of
your choice, for your platforms and devices.
Get started
Tasks
Edit code Build
Write and manage your code using the code editor. Compile and build your source code.
Debug Test
Investigate and fix bugs in your code. Run tests on your projects.
OVERVIEW TRAINING
Prepare your org with the Cloud Build your skills with Microsoft
Adoption Framework Learn training
Python .NET
JavaScript Java
Go REST API
Jenkins Terraform
Azure clouds
Partner solutions
DOWNLOAD TRAINING
Download .NET Build .NET apps with C#
ARCHITECTURE OVERVIEW
.NET architecture docs Azure for .NET developers
OVERVIEW W H AT ' S N E W
.NET Aspire (Preview) What's new in .NET
Programming languages
Write your app in your favorite language
Write .NET apps in C#, F#, or Visual A modern, object-oriented, and type-
Basic safe language
A simple language for succinct, An approachable language with
robust, and performant code readable syntax
Web Mobile
ASP.NET Core tutorials .NET Multi-platform App UI (.NET MAUI)
What is ASP.NET Core? Xamarin.Forms
ASP.NET Core in Visual Studio Xamarin.iOS
ASP.NET MVC apps in Windows containers Xamarin.Android
Blazor: Interactive client-side web UI with .NET Develop Xamarin apps with Azure
F# for web development
Desktop Microservices
Universal Windows apps Dapr for .NET developers
Windows Presentation Foundation (.NET 5+) Cloud native .NET apps
Windows Presentation Foundation (.NET Serverless apps with Azure
Framework)
Architecture for containerized .NET apps
Windows Forms (.NET 5+)
Deploy a Worker Service to Azure
Windows Forms (.NET Framework)
.NET Multi-platform App UI (.NET MAUI)
Xamarin for macOS
Are you interested in contributing to the .NET docs? For more information, see our contributor guide.