mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-11-04 17:13:24 +08:00 
			
		
		
		
	Proof-read Change Edition script
This commit is contained in:
		
							parent
							
								
									0d26ba046e
								
							
						
					
					
						commit
						21bb316d5b
					
				@ -19,7 +19,7 @@ set _stg=0
 | 
			
		||||
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
::  Set Environment variables, it helps if they are misconfigured in the system
 | 
			
		||||
::  Set environment variables, it helps if they are misconfigured in the system
 | 
			
		||||
 | 
			
		||||
setlocal EnableExtensions
 | 
			
		||||
setlocal DisableDelayedExpansion
 | 
			
		||||
@ -84,7 +84,7 @@ cls
 | 
			
		||||
pushd "%~dp0"
 | 
			
		||||
>nul findstr /v "$" "%~nx0" && (
 | 
			
		||||
echo:
 | 
			
		||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
 | 
			
		||||
echo Error - Script either has an LF line ending issue or the empty line at the end of the script is missing.
 | 
			
		||||
echo:
 | 
			
		||||
echo:
 | 
			
		||||
echo Help - %mas%troubleshoot
 | 
			
		||||
@ -127,13 +127,13 @@ set "line=echo _________________________________________________________________
 | 
			
		||||
if %winbuild% LSS 7600 (
 | 
			
		||||
%nceline%
 | 
			
		||||
echo Unsupported OS version detected [%winbuild%].
 | 
			
		||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent.
 | 
			
		||||
echo MAS only supports Windows 7/8/8.1/10/11 and their Server equivalents.
 | 
			
		||||
goto dk_done
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
::  Fix special characters limitation in path name
 | 
			
		||||
::  Fix special character limitations in path name
 | 
			
		||||
 | 
			
		||||
set "_work=%~dp0"
 | 
			
		||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
			
		||||
@ -195,7 +195,7 @@ goto dk_done
 | 
			
		||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
 | 
			
		||||
%eline%
 | 
			
		||||
echo This script needs admin rights.
 | 
			
		||||
echo To do so, right click on this script and select 'Run as administrator'.
 | 
			
		||||
echo Right click on this script and select 'Run as administrator'.
 | 
			
		||||
goto dk_done
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -254,14 +254,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
 | 
			
		||||
if defined old (
 | 
			
		||||
echo ________________________________________________
 | 
			
		||||
%eline%
 | 
			
		||||
echo Version %masver% of MAS is outdated.
 | 
			
		||||
echo Your version of MAS [%masver%] is outdated.
 | 
			
		||||
echo ________________________________________________
 | 
			
		||||
echo:
 | 
			
		||||
if not %_unattended%==1 (
 | 
			
		||||
echo [1] Get Latest MAS
 | 
			
		||||
echo [0] Continue Anyway
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %_Green% "Enter a menu option on your keyboard [1,0] :"
 | 
			
		||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
 | 
			
		||||
choice /C:10 /N
 | 
			
		||||
if !errorlevel!==2 rem
 | 
			
		||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
 | 
			
		||||
@ -280,7 +280,7 @@ if not defined desktop for /f "delims=" %%a in ('%psc% "& {write-host $([Environ
 | 
			
		||||
 | 
			
		||||
if not defined desktop (
 | 
			
		||||
%eline%
 | 
			
		||||
echo Desktop location was not detected, aborting...
 | 
			
		||||
echo Unable to detect Desktop location, aborting...
 | 
			
		||||
goto dk_done
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -335,7 +335,7 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
 | 
			
		||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
 | 
			
		||||
if not defined apps (
 | 
			
		||||
%eline%
 | 
			
		||||
echo Either key is not insalled or failed to get installed key activation ID. Aborting...
 | 
			
		||||
echo Either key is not installed or MAS failed to get installed keys' activation ID. Aborting...
 | 
			
		||||
echo:
 | 
			
		||||
set fixes=%fixes% %mas%troubleshoot
 | 
			
		||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
 | 
			
		||||
@ -356,7 +356,7 @@ if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
 | 
			
		||||
 | 
			
		||||
if %osedition%==0 (
 | 
			
		||||
%eline%
 | 
			
		||||
echo Failed to detect OS Edition. Aborting...
 | 
			
		||||
echo Failed to detect OS edition. Aborting...
 | 
			
		||||
echo:
 | 
			
		||||
set fixes=%fixes% %mas%troubleshoot
 | 
			
		||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
 | 
			
		||||
@ -376,7 +376,7 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
 | 
			
		||||
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
::  Get Target editions list
 | 
			
		||||
::  Get target editions list
 | 
			
		||||
 | 
			
		||||
set _target=
 | 
			
		||||
set _dtarget=
 | 
			
		||||
@ -403,7 +403,7 @@ call :dk_color %Red% "==== Note ===="
 | 
			
		||||
echo:
 | 
			
		||||
echo [EditionID:%osedition% ^| %fullbuild%]
 | 
			
		||||
echo:
 | 
			
		||||
echo Changing this edition to any other may not remove "%osedition%" specific features.
 | 
			
		||||
echo Changing this edition may not remove "%osedition%" specific features.
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %_Yellow% "Press 7 key to continue..."
 | 
			
		||||
choice /c 7 /n
 | 
			
		||||
@ -423,9 +423,9 @@ echo %%# | findstr /i "CountrySpecific CloudEdition" %nul% || (set "_ntarget=!_n
 | 
			
		||||
if not defined _ntarget (
 | 
			
		||||
%line%
 | 
			
		||||
echo:
 | 
			
		||||
if defined dismnotworking call :dk_color %Red% "DISM.exe is not working."
 | 
			
		||||
call :dk_color %Gray% "Target Edition not found."
 | 
			
		||||
echo Current Edition [%osedition% ^| %winbuild%] can not be changed to any other Edition.
 | 
			
		||||
if defined dismnotworking call :dk_color %Red% "DISM is not working."
 | 
			
		||||
call :dk_color %Gray% "Target edition not found."
 | 
			
		||||
echo Current edition [%osedition% ^| %winbuild%] can not be changed.
 | 
			
		||||
%line%
 | 
			
		||||
goto dk_done
 | 
			
		||||
)
 | 
			
		||||
@ -443,11 +443,11 @@ set targetedition=
 | 
			
		||||
 | 
			
		||||
%line%
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %Gray% "You can change the Edition [%osedition%] [%fullbuild%] to one of the following."
 | 
			
		||||
call :dk_color %Gray% "You can change the edition [%osedition%] [%fullbuild%] to one of the following:"
 | 
			
		||||
%showeditionerror%
 | 
			
		||||
if defined dismnotworking (
 | 
			
		||||
call :dk_color %_Yellow% "Note - DISM.exe is not working."
 | 
			
		||||
if /i "%osedition:~0,4%"=="Core" call :dk_color %_Yellow% "     - You will see more edition options to choose once its changed to Pro."
 | 
			
		||||
call :dk_color %_Yellow% "Note - DISM is not working."
 | 
			
		||||
if /i "%osedition:~0,4%"=="Core" call :dk_color %_Yellow% "     - You will see more editions to choose from once you've changed to Professional."
 | 
			
		||||
)
 | 
			
		||||
%line%
 | 
			
		||||
echo:
 | 
			
		||||
@ -462,7 +462,7 @@ set targetedition!counter!=%%A
 | 
			
		||||
echo:
 | 
			
		||||
echo [0]  %_exitmsg%
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %_Green% "Enter option number in keyboard, and press "Enter":"
 | 
			
		||||
call :dk_color %_Green% "Enter an option number on your keyboard and press Enter to confirm:"
 | 
			
		||||
set /p inpt=
 | 
			
		||||
if "%inpt%"=="" goto cedmenu2
 | 
			
		||||
if "%inpt%"=="0" exit /b
 | 
			
		||||
@ -483,12 +483,12 @@ echo:
 | 
			
		||||
call :dk_color %Red% "==== Note ===="
 | 
			
		||||
echo:
 | 
			
		||||
echo Once the edition is changed to "%targetedition%", 
 | 
			
		||||
echo system may not be able to properly change edition to any other later.
 | 
			
		||||
echo the system may not be able to properly change edition later.
 | 
			
		||||
echo:
 | 
			
		||||
echo [1] Continue
 | 
			
		||||
echo [0] Go Back
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %_Green% "Enter a menu option on your keyboard [1,0] :"
 | 
			
		||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
 | 
			
		||||
choice /C:10 /N
 | 
			
		||||
if !errorlevel!==2 goto cedmenu2
 | 
			
		||||
if !errorlevel!==1 rem
 | 
			
		||||
@ -499,7 +499,7 @@ set key=
 | 
			
		||||
set _chan=
 | 
			
		||||
set _dismapi=0
 | 
			
		||||
 | 
			
		||||
::  Check if DISM Api or slmgr.vbs is required for edition upgrade
 | 
			
		||||
::  Check if DISM API or slmgr.vbs is required for edition upgrade
 | 
			
		||||
 | 
			
		||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
 | 
			
		||||
echo %_wtarget% | find /i " %targetedition% " || (
 | 
			
		||||
@ -543,14 +543,14 @@ cls
 | 
			
		||||
%line%
 | 
			
		||||
echo:
 | 
			
		||||
%showeditionerror%
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working."
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "DISM is not working."
 | 
			
		||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
 | 
			
		||||
echo:
 | 
			
		||||
 | 
			
		||||
if %_dismapi%==1 (
 | 
			
		||||
call :dk_color %Green% "Notes-"
 | 
			
		||||
call :dk_color %Green% "Notes -"
 | 
			
		||||
echo:
 | 
			
		||||
echo  - Save your work before continue, system will auto restart.
 | 
			
		||||
echo  - Save your work before continuing, system will auto-restart.
 | 
			
		||||
echo:
 | 
			
		||||
echo  - You will need to activate with HWID option once the edition is changed.
 | 
			
		||||
%line%
 | 
			
		||||
@ -562,7 +562,7 @@ if !errorlevel!==1 exit /b
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
if %_dismapi%==0 (
 | 
			
		||||
echo Installing %_chan% Key [%key%]
 | 
			
		||||
echo Installing %_chan% key [%key%]
 | 
			
		||||
echo:
 | 
			
		||||
if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul%
 | 
			
		||||
if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
 | 
			
		||||
@ -574,7 +574,7 @@ if !keyerror! EQU 0 (
 | 
			
		||||
call :dk_refresh
 | 
			
		||||
call :dk_color %Green% "[Successful]"
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %Gray% "Reboot is required to properly change the Edition."
 | 
			
		||||
call :dk_color %Gray% "Reboot is required to properly change the edition."
 | 
			
		||||
) else (
 | 
			
		||||
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
 | 
			
		||||
echo:
 | 
			
		||||
@ -585,7 +585,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
 | 
			
		||||
 | 
			
		||||
if %_dismapi%==1 (
 | 
			
		||||
echo:
 | 
			
		||||
echo Applying the DISM API method with %_chan% Key %key%. Please wait...
 | 
			
		||||
echo Applying the DISM API method with %_chan% key %key%. Please wait...
 | 
			
		||||
echo:
 | 
			
		||||
 | 
			
		||||
call :ced_prep
 | 
			
		||||
@ -613,10 +613,10 @@ if defined rebootreq goto dk_done
 | 
			
		||||
 | 
			
		||||
echo:
 | 
			
		||||
%showeditionerror%
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM is not working."
 | 
			
		||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %Blue% "Important - Save your work before continue, system will auto reboot."
 | 
			
		||||
call :dk_color %Blue% "Important - Save your work before continuing, system will auto reboot."
 | 
			
		||||
echo:
 | 
			
		||||
choice /C:01 /N /M "[1] Continue [0] %_exitmsg% : "
 | 
			
		||||
if %errorlevel%==1 exit /b
 | 
			
		||||
@ -670,7 +670,7 @@ if defined rebootreq goto dk_done
 | 
			
		||||
cls
 | 
			
		||||
echo:
 | 
			
		||||
%showeditionerror%
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
 | 
			
		||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM is not working."
 | 
			
		||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
 | 
			
		||||
echo:
 | 
			
		||||
 | 
			
		||||
@ -700,7 +700,7 @@ for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time
 | 
			
		||||
sc query TrustedInstaller | find /i "RUNNING" %nul% && (
 | 
			
		||||
%eline%
 | 
			
		||||
echo Failed to stop TrustedInstaller service.
 | 
			
		||||
echo Try again or Restart your system and then try again.
 | 
			
		||||
echo Try again or restart your system and try again.
 | 
			
		||||
set preperror=1
 | 
			
		||||
exit /b
 | 
			
		||||
)
 | 
			
		||||
@ -733,7 +733,7 @@ echo:
 | 
			
		||||
if %winbuild% GEQ 9200 %psc% "if ((Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State -eq 'Enabled') {Write-Host 'Checking .NET Framework 3.5 Status - Enabled'}"
 | 
			
		||||
echo Log files are copied to the ChangeEdition_Logs folder on the desktop.
 | 
			
		||||
echo:
 | 
			
		||||
call :dk_color %Blue% "In case of errors, restart system before trying again."
 | 
			
		||||
call :dk_color %Blue% "In case there's errors, you should restart the system before trying again."
 | 
			
		||||
echo:
 | 
			
		||||
set fixes=%fixes% %mas%change_edition_issues
 | 
			
		||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
 | 
			
		||||
@ -891,7 +891,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Upd
 | 
			
		||||
 | 
			
		||||
if defined rebootreq (
 | 
			
		||||
%eline%
 | 
			
		||||
echo Pending Reboot flags found.
 | 
			
		||||
echo Pending reboot flags found.
 | 
			
		||||
echo:
 | 
			
		||||
echo Make sure Windows is fully updated, restart the system and try again.
 | 
			
		||||
)
 | 
			
		||||
@ -987,13 +987,13 @@ echo:
 | 
			
		||||
if %_unattended%==1 timeout /t 2 & exit /b
 | 
			
		||||
 | 
			
		||||
if defined fixes (
 | 
			
		||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
 | 
			
		||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
 | 
			
		||||
choice /C:10 /N
 | 
			
		||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined terminal (
 | 
			
		||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
 | 
			
		||||
call :dk_color %_Yellow% "Press [0] to %_exitmsg%..."
 | 
			
		||||
choice /c 0 /n
 | 
			
		||||
) else (
 | 
			
		||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user