Skip to content

Instantly share code, notes, and snippets.

@Tcip
Created March 27, 2024 21:42
Show Gist options
  • Select an option

  • Save Tcip/9401dcf8a93a61446de6b78e36cd86f2 to your computer and use it in GitHub Desktop.

Select an option

Save Tcip/9401dcf8a93a61446de6b78e36cd86f2 to your computer and use it in GitHub Desktop.
echo Windows Edition using the PowerShell environment variable POWERSHELL_DISTRIBUTION_CHANNEL. This version store the data in a variable and then call it with echo command
@echo off
SET _we="%POWERSHELL_DISTRIBUTION_CHANNEL%"
FOR /F "tokens=* delims=MSI:" %%G IN (%_we%) DO SET _newvar=%%G
echo. %_newvar%
pause
@Darkerowl
Copy link

Darkerowl commented Jul 6, 2025

May I ask a question about Environmental Variables, so I'm on Windows 11 pro but as I use PowerToys a newish program within windows that adds new toys to play with. I'm using the advanced admin: Environmental Variables, I know I should not mess with many of these with risk of messing up windows or locking myself out of windows again. I just have 1 question I could not answer and if you don't know it's okay I just found your page here and saw this ↑ (Echo Win10home upload), my knowledge about environmental variables is limited. ok my question is under System, Name: POWERSHELL_DISTRIBUTION_CHANNEL Value: MSI:Windows 10 Pro, I'm running Windows 11 pro, is this set to windows 10 pro for a certain reason, should I reinstall PowerShell which is says my PS is at version 7.5.1 when I launch it, Or should I change the Value to MSI:Windows 11pro and see what happens. I wanted to ask someone before I did anything; I messed with TMP once in the past and it locked me out of windows completely so I'm throwing more caution to this than I normally would. Lastly will it just not affect anything, and this is a way for PowerShell to say my windows version in PowerShell even if it's wrong? idk which is why I ask, your page show a huge amount of experience, so anything said will help no matter what. Also thank you for hearing me out also if you read this!
PowerShell Git: Issue Reported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment