Skip to content

Instantly share code, notes, and snippets.

@yuntsewu
Created September 20, 2017 21:08
Show Gist options
  • Save yuntsewu/ddf969d74ac5146f0fcd607abda13ee4 to your computer and use it in GitHub Desktop.
Save yuntsewu/ddf969d74ac5146f0fcd607abda13ee4 to your computer and use it in GitHub Desktop.
On Windows 10, right click and press "Run with PowerShell" will install "Windows Subsystem for Linux" on your system. After it completes, Win+R -> bash will prompt you for the initialization.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
}
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment