forked from TerryHuangHD/Windows10-VersionSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathWindows-Edition-Switcher.bat
More file actions
505 lines (433 loc) · 13.1 KB
/
Copy pathWindows-Edition-Switcher.bat
File metadata and controls
505 lines (433 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
@echo off
set "uiver=1.0"
title Windows Edition Switcher %uiver%
mode con cols=86 lines=30
net session >nul 2>&1
if %errorLevel% == 0 (
GOTO pac
) else (
ECHO This script requires administrator privileges.
ECHO To do so, right-click on this script and select 'Run as administrator'
GOTO end
)
:pac
set "te_cnt=0"
set "te=for /L %%n in (1 1 ^!te_cnt^!) DO echo ^!te[%%n]^!"
set "_te=for /f "tokens=4" %%t in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition "')do set /a te_cnt+=1 && set "te[!te_cnt!]=%%t""
set "_eid=for /f "skip=2 tokens=2*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID 2^>nul') do set "eid=%%H""
set "_pn=for /f "skip=2 tokens=2*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName 2^>nul') do set "pn=%%H""
set "_pkc=for /f "tokens=4" %%a in ('cscript slmgr.vbs /dlv ^| findstr /i /c:"Product Key Channel"') do set "pkc=%%a""
set "_c1=if not '%choice%'=='' set choice=%choice:~0,1%"
set "_c2=if not '%choice%'=='' set choice=%choice:~0,2%"
set "ce=ECHO [4mCurrent edition[0m:"
set "ss=ECHO [4mSwitches supported[0m:"
set "secpk=GOTO switcheditioncpk"
for /f "tokens=4 delims=[]. " %%G in ('ver') do set osver=%%G
for /f "tokens=6 delims=[]. " %%L in ('ver') do set osbuild=%%L
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
set ostype=Server
)
if not defined ostype set ostype=Client
%_eid%
if %osver% LSS 10 (
ECHO This Windows build version is not supported by this script.
GOTO end
)
if [%ostype%]==[Server] (
ECHO Windows Server editions are not currently supported by this script.
GOTO end
)
if %osbuild% LSS 19044 if [%eid%]==[EnterpriseS] (
ECHO This Windows LTSB/LTSC build version is not supported by this script.
GOTO end
)
:start
setlocal enabledelayedexpansion
CLS
ECHO.
ECHO.
ECHO [1m****************************[0m
ECHO [1m* Windows Edition Switcher *[0m
ECHO [1m****************************[0m
%_pn% & %_eid% & %_pkc% & %_te%
CLS
:editions
%ce%
ECHO [1m%pn% (%eid%) [%pkc%][0m
ECHO.
%ss%
%te%
ECHO.
ECHO.
ECHO [4mSelect one of the following[0m:
ECHO 1. Home (Core)
ECHO 2. Professional
ECHO 3. Education
ECHO 4. Enterprise
ECHO 5. Exit
ECHO.
choice /c 12345 /n >nul 2>&1
if %errorlevel%==1 GOTO homeedition
if %errorlevel%==2 GOTO proedition
if %errorlevel%==3 GOTO eduedition
if %errorlevel%==4 GOTO enterpriseedition
if %errorlevel%==5 GOTO end
:homeedition
CLS
%ss%
%te%
ECHO.
ECHO [1m - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ECHO ^| Home (Core) ^| 1. [Retail] ^| 2. [Volume:GVLK] ^|
ECHO ^| Home (Core) N ^| 3. [Retail] ^| 4. [Volume:GVLK] ^|
ECHO ^| Home Single Language ^| 5. [Retail] ^| 6. [Volume:GVLK] ^|
ECHO ^| Home Country Specific (China) ^| 7. [Retail] ^| 8. [Volume:GVLK] ^|
ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[0m
ECHO.
:askhomeedition
set choice=
set /p choice=Enter Home edition number, [b]ack or [e]xit:
ECHO.
%_c2%
if '%choice%'=='1' GOTO core
if '%choice%'=='2' GOTO gvlkcore
if '%choice%'=='3' GOTO coren
if '%choice%'=='4' GOTO gvlkcoren
if '%choice%'=='5' GOTO coresinglelanguage
if '%choice%'=='6' GOTO gvlkcoresinglelanguage
if '%choice%'=='7' GOTO corecountryspecific
if '%choice%'=='8' GOTO gvlkcorecountryspecific
if /i '%choice%'=='b' CLS & GOTO editions
if /i '%choice%'=='back' CLS & GOTO editions
if /i '%choice%'=='e' GOTO end
if /i '%choice%'=='exit' GOTO end
if not defined '%choice%' (
ECHO Your choice is not valid. Please try again.
GOTO askhomeedition
)
GOTO askhomeedition
:proedition
CLS
%ss%
%te%
ECHO.
ECHO [1m - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ECHO ^| Professional ^| 1. [Retail] ^| 2. [Volume:GVLK] ^|
ECHO ^| Professional N ^| 3. [Retail] ^| 4. [Volume:GVLK] ^|
ECHO ^| Pro Single Language ^| 5. [Retail] ^| ^|
ECHO ^| Pro Country Specific (China) ^| 7. [Retail] ^| ^|
ECHO ^| Professional Workstation ^| 9. [Retail] ^| 10. [Volume:GVLK] ^|
ECHO ^| Professional Workstation N ^| 11. [Retail] ^| 12. [Volume:GVLK] ^|
ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[0m
ECHO.
:askproedition
set choice=
set /p choice=Enter Professional edition number, [b]ack or [e]xit:
ECHO.
%_c2%
if '%choice%'=='1' GOTO professional
if '%choice%'=='2' GOTO gvlkprofessional
if '%choice%'=='3' GOTO professionaln
if '%choice%'=='4' GOTO gvlkprofessionaln
if '%choice%'=='5' GOTO professionalsinglelanguage
if '%choice%'=='7' GOTO professionalcountryspecific
if '%choice%'=='9' GOTO professionalworkstation
if '%choice%'=='10' GOTO gvlkprofessionalworkstation
if '%choice%'=='11' GOTO professionalworkstationn
if '%choice%'=='12' GOTO gvlkprofessionalworkstationn
if /i '%choice%'=='b' CLS & GOTO editions
if /i '%choice%'=='back' CLS & GOTO editions
if /i '%choice%'=='e' GOTO end
if /i '%choice%'=='exit' GOTO end
if not defined '%choice%' (
ECHO Your choice is not valid. Please try again.
GOTO askproedition
)
:eduedition
CLS
%ss%
%te%
ECHO.
ECHO [1m - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ECHO ^| Education ^| 1. [Retail] ^| 2. [Volume:GVLK] ^|
ECHO ^| Education N ^| 3. [Retail] ^| 4. [Volume:GVLK] ^|
ECHO ^| Professional Education ^| 5. [Retail] ^| 6. [Volume:GVLK] ^|
ECHO ^| Professional Education N ^| 7. [Retail] ^| 8. [Volume:GVLK] ^|
ECHO ^| Cloud Edition SE ^| 9. [Retail] ^| 10. [Volume:GVLK] ^|
ECHO ^| Cloud Edition N SE ^| 11. [Retail] ^| 12. [Volume:GVLK] ^|
ECHO ^| Lean/CloudE S ^| 13. [Retail] ^| 14. [Volume:GVLK] ^|
ECHO ^| Lean/CloudE S N ^| 15. [Retail] ^| ^|
ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[0m
ECHO.
:askeduedition
set choice=
set /p choice=Enter Education edition number, [b]ack or [e]xit:
ECHO.
%_c2%
if '%choice%'=='1' GOTO education
if '%choice%'=='2' GOTO gvlkeducation
if '%choice%'=='3' GOTO educationn
if '%choice%'=='4' GOTO gvlkeducationn
if '%choice%'=='5' GOTO professionaleducation
if '%choice%'=='6' GOTO gvlkprofessionaleducation
if '%choice%'=='7' GOTO professionaleducationn
if '%choice%'=='8' GOTO gvlkprofessionaleducationn
if '%choice%'=='9' GOTO cloudedition
if '%choice%'=='10' GOTO gvlkcloudedition
if '%choice%'=='11' GOTO cloudeditionn
if '%choice%'=='12' GOTO gvlkcloudeditionn
if '%choice%'=='13' GOTO cloude
if '%choice%'=='14' GOTO gvlkcloude
if '%choice%'=='15' GOTO clouden
if /i '%choice%'=='b' CLS & GOTO editions
if /i '%choice%'=='back' CLS & GOTO editions
if /i '%choice%'=='e' GOTO end
if /i '%choice%'=='exit' GOTO end
if not defined '%choice%' (
ECHO Your choice is not valid. Please try again.
GOTO askeduedition
)
:enterpriseedition
CLS
%ss%
%te%
ECHO.
ECHO [1m - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ECHO ^| Enterprise ^| 1. [OEM:NONSLP ] ^| 2. [Volume:GVLK] ^|
ECHO ^| Enterprise N ^| 3. [Volume:GVLK] ^| 4. [Volume:GVLK] ^|
ECHO ^| Enterprise G ^| 5. [OEM:NONSLP ] ^| 6. [Volume:GVLK] ^|
ECHO ^| Enterprise G N ^| 7. [OEM:NONSLP ] ^| 8. [Volume:GVLK] ^|
ECHO ^| Enterprise LTSC (S) ^| 9. [Volume:MAK ] ^| 10. [Volume:GVLK] ^|
ECHO ^| Enterprise N LTSC ^| 11. [Volume:GVLK] ^| 12. [Volume:GVLK] ^|
ECHO ^| Enterprise (ServerRdsh) ^| 13. [ Retail ] ^| 14. [Volume:GVLK] ^|
ECHO ^| IoT Enterprise ^| 15. [ OEM:DM ] ^| ^|
ECHO ^| IoT Enterprise LTSC (S) ^| 17. [OEM:NONSLP ] ^| ^|
ECHO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[0m
ECHO.
:askenterpriseedition
set choice=
set /p choice=Enter Enterprise edition number, [b]ack or [e]xit:
ECHO.
%_c2%
if '%choice%'=='1' GOTO enterprise
if '%choice%'=='2' GOTO gvlkenterprise
if '%choice%'=='3' GOTO enterprisen
if '%choice%'=='4' GOTO gvlkenterprisen
if '%choice%'=='5' GOTO enterpriseg
if '%choice%'=='6' GOTO gvlkenterpriseg
if '%choice%'=='7' GOTO enterprisegn
if '%choice%'=='8' GOTO gvlkenterprisegn
if '%choice%'=='9' GOTO enterprises_2021
if '%choice%'=='10' GOTO gvlkenterprises_2021
if '%choice%'=='11' GOTO enterprisesn_2021
if '%choice%'=='12' GOTO gvlkenterprisesn_2021
if '%choice%'=='13' GOTO serverrdsh
if '%choice%'=='14' GOTO gvlkserverrdsh
if '%choice%'=='15' GOTO iotenterprise
if '%choice%'=='17' GOTO iotenterprises
if /i '%choice%'=='b' CLS & GOTO editions
if /i '%choice%'=='back' CLS & GOTO editions
if /i '%choice%'=='e' GOTO end
if /i '%choice%'=='exit' GOTO end
if not defined '%choice%' (
ECHO Your choice is not valid. Please try again.
GOTO askenterpriseedition
)
:core
set "pk=YTMG3-N6DKC-DKB77-7M9GH-8HVX7"
%secpk%
:gvlkcore
set "pk=TX9XD-98N7V-6WMQ6-BX7FG-H8Q99"
%secpk%
:coren
set "pk=4CPRK-NM3K3-X6XXQ-RXX86-WXCHW"
%secpk%
:gvlkcoren
set "pk=3KHY7-WNT83-DGQKR-F7HPR-844BM"
%secpk%
:coresinglelanguage
set "pk=BT79Q-G7N6G-PGBYW-4YWX6-6F4BT"
%secpk%
:gvlkcoresinglelanguage
set "pk=7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH"
%secpk%
:corecountryspecific
set "pk=N2434-X9D7W-8PF6X-8DV9T-8TYMD"
%secpk%
:gvlkcorecountryspecific
set "pk=PVMJN-6DFY6-9CCP6-7BKTT-D3WVR"
%secpk%
:professional
set "pk=VK7JG-NPHTM-C97JM-9MPGT-3V66T"
%secpk%
:gvlkprofessional
set "pk=W269N-WFGWX-YVC9B-4J6C9-T83GX"
%secpk%
:professionaln
set "pk=2B87N-8KFHP-DKV6R-Y2C8J-PKCKT"
%secpk%
:gvlkprofessionaln
set "pk=MH37W-N47XK-V7XM9-C7227-GCQG9"
%secpk%
:professionalsinglelanguage
set "pk=G3KNM-CHG6T-R36X3-9QDG6-8M8K9"
%secpk%
:professionalcountryspecific
set "pk=HNGCC-Y38KG-QVK8D-WMWRK-X86VK"
%secpk%
:professionalworkstation
set "pk=DXG7C-N36C4-C4HTG-X4T3X-2YV77"
%secpk%
:gvlkprofessionalworkstation
set "pk=NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J"
%secpk%
:professionalworkstationn
set "pk=WYPNQ-8C467-V2W6J-TX4WX-WT2RQ"
%secpk%
:gvlkprofessionalworkstationn
set "pk=9FNHH-K3HBT-3W4TD-6383H-6XYWF"
%secpk%
:professionaleducation
set "pk=8PTT6-RNW4C-6V7J2-C2D3X-MHBPB"
%secpk%
:gvlkprofessionaleducation
set "pk=6TP4R-GNPTD-KYYHQ-7B7DP-J447Y"
%secpk%
:professionaleducationn
set "pk=GJTYN-HDMQY-FRR76-HVGC7-QPF8P"
%secpk%
:gvlkprofessionaleducationn
set "pk=YVWGF-BXNMC-HTQYQ-CPQ99-66QFC"
%secpk%
:education
set "pk=YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY"
%secpk%
:gvlkeducation
set "pk=NW6C2-QMPVW-D7KKK-3GKT6-VCFB2"
%secpk%
:educationn
set "pk=84NGF-MHBT6-FXBX8-QWJK7-DRR8H"
%secpk%
:gvlkeducationn
set "pk=2WH4N-8QGBV-H22JP-CT43Q-MDWWJ"
%secpk%
:enterprise
set "pk=XGVPP-NMH47-7TTHJ-W3FW7-8HV2C"
%secpk%
:gvlkenterprise
set "pk=NPPR9-FWDCX-D2C8J-H872K-2YT43"
%secpk%
:enterprisen
set "pk=WGGHN-J84D6-QYCPR-T7PJ7-X766F"
%secpk%
:gvlkenterprisen
set "pk=DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4"
%secpk%
:enterpriseg
set "pk=FV469-WGNG4-YQP66-2B2HY-KD8YX"
%secpk%
:gvlkenterpriseg
set "pk=YYVX9-NTFWV-6MDM3-9PT4T-4M68B"
%secpk%
:enterprisegn
set "pk=FW7NV-4T673-HF4VX-9X4MM-B4H4T"
%secpk%
:gvlkenterprisegn
set "pk=44RPN-FTY23-9VTTB-MP9BX-T84FV"
%secpk%
:enterprises_2021
set "pk=KCNVH-YKWX8-GJJB9-H9FDT-6F7W2"
%secpk%
:enterprises_2019
set "pk=43TBQ-NH92J-XKTM7-KT3KK-P39PB"
%secpk%
:gvlkenterprises_2021
set "pk=M7XTQ-FN8P6-TTKYV-9D4CC-J462D"
%secpk%
:enterprisesn_2019
set "pk=2D7NQ-3MDXF-9WTDT-X9CCP-CKD8V"
%secpk%
:enterprisesn_2021
set "pk=2D7NQ-3MDXF-9WTDT-X9CCP-CKD8V"
%secpk%
:gvlkenterprisesn_2021
set "pk=92NFX-8DJQP-P6BBQ-THF9C-7CG2H"
%secpk%
:gvlkenterprises_2016
set "pk=DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ"
%secpk%
:gvlkenterprisesn_2016
set "pk=QFFDN-GRT3P-VKWWX-X7T3R-8B639"
%secpk%
:gvlkenterprises_2015
set "pk=WNMTR-4C88C-JK8YV-HQ7T2-76DF9"
%secpk%
:gvlkenterprisesn_2015
set "pk=2F77B-TNFGY-69QQF-B8YKP-D69TJ"
%secpk%
:serverrdsh
set "pk=NJCF7-PW8QT-3324D-688JX-2YV66"
%secpk%
:gvlkserverrdsh
set "pk=CPWHC-NT2C7-VYW78-DHDB2-PG3GK"
%secpk%
:iotenterprise
set "pk=XQQYW-NFFMW-XJPBH-K8732-CKFFD"
%secpk%
:iotenterprises
set "pk=QPM6N-7J2WJ-P88HH-P3YRH-YY74H"
%secpk%
:cloudedition
set "pk=KY7PN-VR6RX-83W6Y-6DDYQ-T6R4W"
%secpk%
:gvlkcloudedition
set "pk=37D7F-N49CB-WQR8W-TBJ73-FM8RX"
%secpk%
:cloudeditionn
set "pk=K9VKN-3BGWV-Y624W-MCRMQ-BHDCD"
%secpk%
:gvlkcloudeditionn
set "pk=6XN7V-PCBDC-BDBRH-8DQY7-G6R44"
%secpk%
:cloude
set "pk=2HN6V-HGTM8-6C97C-RK67V-JQPFD"
%secpk%
:gvlkcloude
set "pk=NBTWJ-3DR69-3C4V8-C26MC-GQ9M6"
%secpk%
:clouden
set "pk=48FWV-TNW4T-CQ6F4-KVGQB-K3D3X"
%secpk%
:switcheditioncpk
ECHO Switching Windows edition...
changepk /ProductKey %pk%
if not [%errorlevel%]==[0] (
GOTO fail
) else (
GOTO finish
)
:fail
CLS
ECHO.
ECHO [91mFail^^![0m
ECHO.
ECHO Press any key to select another edition...
ECHO.
PAUSE >nul
CLS
GOTO editions
:finish
CLS
ECHO.
echo [92mSuccess^^![0m
ECHO.
%_pn% & %_eid% & %_pkc%
ECHO [4mSwitched to[0m:
ECHO [1m%pn% (%eid%) [%pkc%][0m
ECHO [1mProduct Key [%pk%][0m
ECHO.
ECHO Reboot to finalize edition switch.
:end
ECHO.
ECHO Press any key to exit.
PAUSE >nul