mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-07-05 16:18:20 +00:00
MAS 3.12
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
@::Is a real person even the one deciding to flag this or is it Copilot told to flag anything it decides not to like?
|
@::Is a real person even the one deciding to flag this or is it Copilot told to flag anything it decides not to like?
|
||||||
@::If a campaign is using this script as a cover, please flag parts of the campaign instead of the script. This isn't the first time we experienced collateral damage due to campaigns completely unrelated to us.
|
@::If a campaign is using this script as a cover, please flag parts of the campaign instead of the script. This isn't the first time we experienced collateral damage due to campaigns completely unrelated to us.
|
||||||
@::If you disagree that MAS is not malicious, we would appreciate if you contacted us to explain what constitutes MAS as "Sonbokli" and we'll look into it. Thank you.
|
@::If you disagree that MAS is not malicious, we would appreciate if you contacted us to explain what constitutes MAS as "Sonbokli" and we'll look into it. Thank you.
|
||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@setlocal DisableDelayedExpansion
|
@setlocal DisableDelayedExpansion
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
@@ -41,9 +41,20 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
|
||||||
for %%# in (%*) do (
|
for %%# in (%*) do (
|
||||||
if /i "%%#"=="re1" set re1=1
|
if /i "%%#"=="re1" set re1=1
|
||||||
if /i "%%#"=="re2" set re2=1
|
if /i "%%#"=="re2" set re2=1
|
||||||
@@ -91,8 +102,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -101,10 +111,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -188,10 +196,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -200,7 +207,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -330,11 +337,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -2331,7 +2338,7 @@ set key=%%B
|
|||||||
REM Generate ticket
|
REM Generate ticket
|
||||||
|
|
||||||
if %1==ticket if "%key%"=="%%B" (
|
if %1==ticket if "%key%"=="%%B" (
|
||||||
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;"
|
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=221306452340115677963964261259250411589493550039199940431586886;"
|
||||||
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
|
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -3229,18 +3236,9 @@ set ierror=mklink sppcs.dll
|
|||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
)
|
)
|
||||||
|
|
||||||
set exhook=
|
|
||||||
if exist "!_work!\BIN\%_hook%" set exhook=1
|
|
||||||
|
|
||||||
if not exist "%_hookPath%\sppc.dll" (
|
if not exist "%_hookPath%\sppc.dll" (
|
||||||
if defined exhook (
|
|
||||||
pushd "!_work!\BIN\"
|
|
||||||
copy /y /b "%_hook%" "%_hookPath%\sppc.dll" %nul%
|
|
||||||
popd
|
|
||||||
) else (
|
|
||||||
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
|
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
|
||||||
)
|
)
|
||||||
)
|
|
||||||
if not exist "%_hookPath%\sppc.dll" (
|
if not exist "%_hookPath%\sppc.dll" (
|
||||||
set ierror=Copy
|
set ierror=Copy
|
||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
@@ -3248,11 +3246,7 @@ goto :oh_hookinstall_error
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
|
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
|
||||||
if defined exhook (
|
|
||||||
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
|
||||||
) else (
|
|
||||||
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
||||||
)
|
|
||||||
|
|
||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
|
|
||||||
@@ -3318,18 +3312,8 @@ set ierror=mklink sppcs.dll
|
|||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
)
|
)
|
||||||
|
|
||||||
set exhook=
|
|
||||||
if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1
|
|
||||||
|
|
||||||
if defined exhook (
|
|
||||||
pushd "!_work!\BIN\"
|
|
||||||
if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%)
|
|
||||||
if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%)
|
|
||||||
popd
|
|
||||||
) else (
|
|
||||||
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
|
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
|
||||||
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
|
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
|
||||||
)
|
|
||||||
|
|
||||||
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
|
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
|
||||||
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
|
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
|
||||||
@@ -3342,13 +3326,8 @@ goto :oh_hookinstall_error
|
|||||||
echo:
|
echo:
|
||||||
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
|
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
|
||||||
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
|
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
|
||||||
if defined exhook (
|
|
||||||
if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
|
||||||
if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
|
||||||
) else (
|
|
||||||
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
||||||
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
||||||
)
|
|
||||||
|
|
||||||
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
|
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
|
||||||
|
|
||||||
@@ -4096,7 +4075,7 @@ $Writer.Write($unixTimestamp)
|
|||||||
$Writer.Flush()
|
$Writer.Flush()
|
||||||
|
|
||||||
# Write the current state of the MemoryStream to a temporary file
|
# Write the current state of the MemoryStream to a temporary file
|
||||||
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())"
|
$tempFilePath = "$env:windir\Temp\$([Guid]::NewGuid().Guid)"
|
||||||
[IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
[IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
||||||
|
|
||||||
# Update hash using the temporary file
|
# Update hash using the temporary file
|
||||||
@@ -4150,12 +4129,6 @@ $MemoryStream.Close()
|
|||||||
::
|
::
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
::
|
::
|
||||||
:: If you want to use a different sppc.dll or without base64 format, then create a folder named "BIN" where this script is located and
|
|
||||||
:: place these two files in that "BIN" folder. sppc32.dll, sppc64.dll
|
|
||||||
:: Script will auto pick that instead of using the below from base64 section. You can also delete the below code in that case.
|
|
||||||
::
|
|
||||||
::========================================================================================================================================
|
|
||||||
::
|
|
||||||
:: Replace "-" with "A" and "_" with "a" before base64 conversion
|
:: Replace "-" with "A" and "_" with "a" before base64 conversion
|
||||||
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding
|
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding
|
||||||
|
|
||||||
@@ -4467,7 +4440,9 @@ echo:
|
|||||||
echo ______________________________________________________________
|
echo ______________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :dk_color2 %_White% " [1] " %_Green% "Auto"
|
call :dk_color2 %_White% " [1] " %_Green% "Auto"
|
||||||
echo Builds ^>= 26100 - StaticCID (KMS4k if offline)
|
echo Builds ^>= 26100 - Windows only - KMS4k
|
||||||
|
echo Other options - StaticCID
|
||||||
|
echo:
|
||||||
echo Builds ^< 26100 - ZeroCID
|
echo Builds ^< 26100 - ZeroCID
|
||||||
echo __________________________________________________
|
echo __________________________________________________
|
||||||
echo:
|
echo:
|
||||||
@@ -4588,6 +4563,9 @@ if /i %_actmethod%==KMS4k set tsmethod=KMS4k
|
|||||||
if /i %_actmethod%==Auto (
|
if /i %_actmethod%==Auto (
|
||||||
if %winbuild% GEQ 26100 (
|
if %winbuild% GEQ 26100 (
|
||||||
set tsmethod=StaticCID
|
set tsmethod=StaticCID
|
||||||
|
if !_actwin!==1 if not !_actwinesuoff!==1 (
|
||||||
|
set tsmethod=KMS4k
|
||||||
|
)
|
||||||
) else (
|
) else (
|
||||||
set tsmethod=ZeroCID
|
set tsmethod=ZeroCID
|
||||||
)
|
)
|
||||||
@@ -4703,7 +4681,7 @@ call :dk_color %Red% "Checking Activation ID [Not Found] [%tsed
|
|||||||
set error=1
|
set error=1
|
||||||
if /i %tsmethod%==KMS4k (
|
if /i %tsmethod%==KMS4k (
|
||||||
if /i %_actmethod%==Auto (
|
if /i %_actmethod%==Auto (
|
||||||
call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method."
|
call :dk_color %Blue% "Return to the previous menu and select StaticCID activation method. Internet connection is required to activate."
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
|
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
|
||||||
)
|
)
|
||||||
@@ -5875,7 +5853,7 @@ if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
|
|||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
) else (
|
) else (
|
||||||
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 (
|
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 if %_actwin%==1 (
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
|
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
|
||||||
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
|
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
|
||||||
@@ -11261,27 +11239,27 @@ namespace LibTSforge.PhysicalStore
|
|||||||
}
|
}
|
||||||
'@
|
'@
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$binPath = "$env:_work\BIN\LibTSforge.dll"
|
|
||||||
$psMajorVer = (Get-Host).Version.Major
|
$psMajorVer = (Get-Host).Version.Major
|
||||||
$build = [System.Environment]::OSVersion.Version.Build
|
$build = [System.Environment]::OSVersion.Version.Build
|
||||||
|
|
||||||
if (Test-Path -LiteralPath $binPath) {
|
|
||||||
Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
|
|
||||||
Add-Type -Path $binPath
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
|
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
|
||||||
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
|
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
|
||||||
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
|
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
|
||||||
|
|
||||||
$ctemp = "$env:SystemRoot\Temp\"
|
$ctemp = "$env:SystemRoot\Temp\$([Guid]::NewGuid().Guid)\"
|
||||||
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
|
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
|
||||||
$env:TMP = $ctemp
|
$env:TMP = $ctemp
|
||||||
$env:TEMP = $ctemp
|
$env:TEMP = $ctemp
|
||||||
|
|
||||||
$cp.GenerateInMemory = $true
|
$cp.GenerateInMemory = $true
|
||||||
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
|
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
|
||||||
|
|
||||||
|
try {
|
||||||
|
$cp.TempFiles.Dispose()
|
||||||
|
} catch {
|
||||||
|
# Older .NET Framework versions do not have that method, but they also don't create the folder that it removes.
|
||||||
}
|
}
|
||||||
|
Remove-Item -Path $ctemp
|
||||||
|
|
||||||
if ($env:_debug -eq '0') {
|
if ($env:_debug -eq '0') {
|
||||||
[LibTSforge.Logger]::HideOutput = $true
|
[LibTSforge.Logger]::HideOutput = $true
|
||||||
@@ -11383,7 +11361,7 @@ if (-not $env:resetstuff) {
|
|||||||
if ($env:tsmethod -eq "KMS4k") {
|
if ($env:tsmethod -eq "KMS4k") {
|
||||||
if ($build -ge 26100) {
|
if ($build -ge 26100) {
|
||||||
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
|
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
|
||||||
Write-Host "From build 26100.7019, Windows will always display and stay at 180 days remaining if the actual period is longer." -ForegroundColor White -BackgroundColor Darkgray
|
Write-Host "From build 26100.7019, Windows will always display a remaining activation period of 180 days in Settings." -ForegroundColor White -BackgroundColor Darkgray
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
|
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
|
||||||
@@ -16901,8 +16879,8 @@ goto :at_menu
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G"
|
||||||
%nul% del /q /f %ddf%
|
set "ddf="%SystemRoot%\Temp\%Random%%randguid%""
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
echo/.set CabinetFileCountThreshold=0;>>%ddf%
|
echo/.set CabinetFileCountThreshold=0;>>%ddf%
|
||||||
@@ -16924,7 +16902,6 @@ for /f "tokens=* delims=" %%D in ('dir /a:-D/b/s "%SystemRoot%\logs\%1"') do (
|
|||||||
echo/"%%~fD" /inf=no;>>%ddf%
|
echo/"%%~fD" /inf=no;>>%ddf%
|
||||||
)
|
)
|
||||||
makecab /F %ddf% /D DiskDirectory1="" /D CabinetNameTemplate="!desktop!\%2_%_time%.cab"
|
makecab /F %ddf% /D DiskDirectory1="" /D CabinetNameTemplate="!desktop!\%2_%_time%.cab"
|
||||||
del /q /f %ddf%
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -17890,7 +17867,7 @@ if($false -eq ($installCandidates.Keys -contains $SetEdition)) {
|
|||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$xmlPath = $Env:SystemRoot + '\Temp' + '\CbsUpgrade.xml'
|
$xmlPath = $Env:SystemRoot + '\Temp' + "\$([Guid]::NewGuid().Guid)CbsUpgrade.xml"
|
||||||
|
|
||||||
Write-UpgradeXml -RemovalCandidates $removalCandidates `
|
Write-UpgradeXml -RemovalCandidates $removalCandidates `
|
||||||
-InstallCandidates $installCandidates[$SetEdition] `
|
-InstallCandidates $installCandidates[$SetEdition] `
|
||||||
@@ -18184,6 +18161,18 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "o_randguid="
|
||||||
|
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid" ^| findstr /r "^[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*$"') do set "o_randguid=%%G"
|
||||||
|
if not defined o_randguid (
|
||||||
|
%eline%
|
||||||
|
echo Unable to generate GUID with PowerShell.
|
||||||
|
echo Aborting...
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
md "%SystemRoot%\Temp\%o_randguid%\"
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:oemenu
|
:oemenu
|
||||||
@@ -18282,7 +18271,7 @@ mode 98, 45
|
|||||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exist %SystemRoot%\Temp\%list%.txt (
|
if not exist %SystemRoot%\Temp\%o_randguid%\%list%.txt (
|
||||||
%eline%
|
%eline%
|
||||||
echo Failed to generate available editions list.
|
echo Failed to generate available editions list.
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
@@ -18304,7 +18293,7 @@ if %winbuild% LSS 10240 (
|
|||||||
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
||||||
) else (
|
) else (
|
||||||
for %%# in (2019 2021 2024) do (
|
for %%# in (2019 2021 2024) do (
|
||||||
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || (
|
find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\%list%.txt" %nul1% || (
|
||||||
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
|
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -18313,7 +18302,7 @@ if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this li
|
|||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%list%.txt) do (
|
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%o_randguid%\%list%.txt) do (
|
||||||
set /a counter+=1
|
set /a counter+=1
|
||||||
if !counter! LSS 10 (
|
if !counter! LSS 10 (
|
||||||
echo [!counter!] %%A
|
echo [!counter!] %%A
|
||||||
@@ -18346,7 +18335,7 @@ set suites=
|
|||||||
echo %list% | find /i "Suites" %nul1% && (
|
echo %list% | find /i "Suites" %nul1% && (
|
||||||
set suites=1
|
set suites=1
|
||||||
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
|
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
if not exist %SystemRoot%\Temp\getAppIds.txt (
|
if not exist %SystemRoot%\Temp\%o_randguid%\getAppIds.txt (
|
||||||
%eline%
|
%eline%
|
||||||
echo Failed to generate available apps list.
|
echo Failed to generate available apps list.
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
@@ -18368,7 +18357,7 @@ Visio
|
|||||||
Word
|
Word
|
||||||
) do (
|
) do (
|
||||||
if defined suites (
|
if defined suites (
|
||||||
find /i "%%#" "%SystemRoot%\Temp\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
|
find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
|
||||||
) else (
|
) else (
|
||||||
set %%#_st=
|
set %%#_st=
|
||||||
)
|
)
|
||||||
@@ -18992,11 +18981,11 @@ exit /b
|
|||||||
|
|
||||||
:oe_tempcleanup
|
:oe_tempcleanup
|
||||||
|
|
||||||
del /f /q %SystemRoot%\Temp\SingleApps_Volume.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\SingleApps_Volume.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\SingleApps_Retail.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\SingleApps_Retail.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\Suites_Volume.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\Suites_Volume.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\Suites_Retail.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\Suites_Retail.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\getAppIds.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\getAppIds.txt %nul%
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -19150,7 +19139,7 @@ if ($windowsBuild -lt 9200) {
|
|||||||
:getlist:
|
:getlist:
|
||||||
$xmlPath1 = $env:_c2rXml
|
$xmlPath1 = $env:_c2rXml
|
||||||
$xmlPath2 = $env:_masterxml
|
$xmlPath2 = $env:_masterxml
|
||||||
$outputDir = $env:SystemRoot + "\Temp\"
|
$outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
|
||||||
$buildNumber = [System.Environment]::OSVersion.Version.Build
|
$buildNumber = [System.Environment]::OSVersion.Version.Build
|
||||||
$excludedKeywords = @("2019", "2021", "2024")
|
$excludedKeywords = @("2019", "2021", "2024")
|
||||||
$productReleaseIds = @()
|
$productReleaseIds = @()
|
||||||
@@ -19210,7 +19199,7 @@ foreach ($section in $categories.Keys) {
|
|||||||
:getappnames:
|
:getappnames:
|
||||||
$xmlPath = $env:_masterxml
|
$xmlPath = $env:_masterxml
|
||||||
$targetSkuId = $env:targetedition
|
$targetSkuId = $env:targetedition
|
||||||
$outputDir = $env:SystemRoot + "\Temp\"
|
$outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
|
||||||
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
|
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
|
||||||
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
|
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +43,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -120,8 +132,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -130,10 +141,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -205,10 +214,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -217,7 +225,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -347,11 +355,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -2021,7 +2029,7 @@ set key=%%B
|
|||||||
REM Generate ticket
|
REM Generate ticket
|
||||||
|
|
||||||
if %1==ticket if "%key%"=="%%B" (
|
if %1==ticket if "%key%"=="%%B" (
|
||||||
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;"
|
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=221306452340115677963964261259250411589493550039199940431586886;"
|
||||||
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
|
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +43,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -120,8 +132,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -130,10 +141,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -214,10 +223,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -226,7 +234,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -356,11 +364,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -1150,18 +1158,9 @@ set ierror=mklink sppcs.dll
|
|||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
)
|
)
|
||||||
|
|
||||||
set exhook=
|
|
||||||
if exist "!_work!\BIN\%_hook%" set exhook=1
|
|
||||||
|
|
||||||
if not exist "%_hookPath%\sppc.dll" (
|
if not exist "%_hookPath%\sppc.dll" (
|
||||||
if defined exhook (
|
|
||||||
pushd "!_work!\BIN\"
|
|
||||||
copy /y /b "%_hook%" "%_hookPath%\sppc.dll" %nul%
|
|
||||||
popd
|
|
||||||
) else (
|
|
||||||
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
|
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
|
||||||
)
|
)
|
||||||
)
|
|
||||||
if not exist "%_hookPath%\sppc.dll" (
|
if not exist "%_hookPath%\sppc.dll" (
|
||||||
set ierror=Copy
|
set ierror=Copy
|
||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
@@ -1169,11 +1168,7 @@ goto :oh_hookinstall_error
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
|
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
|
||||||
if defined exhook (
|
|
||||||
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
|
||||||
) else (
|
|
||||||
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
||||||
)
|
|
||||||
|
|
||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
|
|
||||||
@@ -1239,18 +1234,8 @@ set ierror=mklink sppcs.dll
|
|||||||
goto :oh_hookinstall_error
|
goto :oh_hookinstall_error
|
||||||
)
|
)
|
||||||
|
|
||||||
set exhook=
|
|
||||||
if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1
|
|
||||||
|
|
||||||
if defined exhook (
|
|
||||||
pushd "!_work!\BIN\"
|
|
||||||
if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%)
|
|
||||||
if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%)
|
|
||||||
popd
|
|
||||||
) else (
|
|
||||||
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
|
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
|
||||||
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
|
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
|
||||||
)
|
|
||||||
|
|
||||||
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
|
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
|
||||||
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
|
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
|
||||||
@@ -1263,13 +1248,8 @@ goto :oh_hookinstall_error
|
|||||||
echo:
|
echo:
|
||||||
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
|
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
|
||||||
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
|
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
|
||||||
if defined exhook (
|
|
||||||
if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
|
||||||
if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
|
||||||
) else (
|
|
||||||
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
|
||||||
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
|
||||||
)
|
|
||||||
|
|
||||||
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
|
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
|
||||||
|
|
||||||
@@ -3186,7 +3166,7 @@ $Writer.Write($unixTimestamp)
|
|||||||
$Writer.Flush()
|
$Writer.Flush()
|
||||||
|
|
||||||
# Write the current state of the MemoryStream to a temporary file
|
# Write the current state of the MemoryStream to a temporary file
|
||||||
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())"
|
$tempFilePath = "$env:windir\Temp\$([Guid]::NewGuid().Guid)"
|
||||||
[IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
[IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
||||||
|
|
||||||
# Update hash using the temporary file
|
# Update hash using the temporary file
|
||||||
@@ -3240,12 +3220,6 @@ $MemoryStream.Close()
|
|||||||
::
|
::
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
::
|
::
|
||||||
:: If you want to use a different sppc.dll or without base64 format, then create a folder named "BIN" where this script is located and
|
|
||||||
:: place these two files in that "BIN" folder. sppc32.dll, sppc64.dll
|
|
||||||
:: Script will auto pick that instead of using the below from base64 section. You can also delete the below code in that case.
|
|
||||||
::
|
|
||||||
::========================================================================================================================================
|
|
||||||
::
|
|
||||||
:: Replace "-" with "A" and "_" with "a" before base64 conversion
|
:: Replace "-" with "A" and "_" with "a" before base64 conversion
|
||||||
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding
|
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -68,6 +68,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -145,8 +157,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -155,10 +166,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -245,10 +254,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -257,7 +265,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -387,11 +395,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +77,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -154,8 +166,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -164,10 +175,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -271,10 +280,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -283,7 +291,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -413,11 +421,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -538,7 +546,9 @@ echo:
|
|||||||
echo ______________________________________________________________
|
echo ______________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :dk_color2 %_White% " [1] " %_Green% "Auto"
|
call :dk_color2 %_White% " [1] " %_Green% "Auto"
|
||||||
echo Builds ^>= 26100 - StaticCID (KMS4k if offline)
|
echo Builds ^>= 26100 - Windows only - KMS4k
|
||||||
|
echo Other options - StaticCID
|
||||||
|
echo:
|
||||||
echo Builds ^< 26100 - ZeroCID
|
echo Builds ^< 26100 - ZeroCID
|
||||||
echo __________________________________________________
|
echo __________________________________________________
|
||||||
echo:
|
echo:
|
||||||
@@ -659,6 +669,9 @@ if /i %_actmethod%==KMS4k set tsmethod=KMS4k
|
|||||||
if /i %_actmethod%==Auto (
|
if /i %_actmethod%==Auto (
|
||||||
if %winbuild% GEQ 26100 (
|
if %winbuild% GEQ 26100 (
|
||||||
set tsmethod=StaticCID
|
set tsmethod=StaticCID
|
||||||
|
if !_actwin!==1 if not !_actwinesuoff!==1 (
|
||||||
|
set tsmethod=KMS4k
|
||||||
|
)
|
||||||
) else (
|
) else (
|
||||||
set tsmethod=ZeroCID
|
set tsmethod=ZeroCID
|
||||||
)
|
)
|
||||||
@@ -774,7 +787,7 @@ call :dk_color %Red% "Checking Activation ID [Not Found] [%tsed
|
|||||||
set error=1
|
set error=1
|
||||||
if /i %tsmethod%==KMS4k (
|
if /i %tsmethod%==KMS4k (
|
||||||
if /i %_actmethod%==Auto (
|
if /i %_actmethod%==Auto (
|
||||||
call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method."
|
call :dk_color %Blue% "Return to the previous menu and select StaticCID activation method. Internet connection is required to activate."
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
|
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
|
||||||
)
|
)
|
||||||
@@ -1946,7 +1959,7 @@ if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
|
|||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
) else (
|
) else (
|
||||||
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 (
|
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 if %_actwin%==1 (
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
|
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
|
||||||
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
|
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
|
||||||
@@ -8825,27 +8838,27 @@ namespace LibTSforge.PhysicalStore
|
|||||||
}
|
}
|
||||||
'@
|
'@
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$binPath = "$env:_work\BIN\LibTSforge.dll"
|
|
||||||
$psMajorVer = (Get-Host).Version.Major
|
$psMajorVer = (Get-Host).Version.Major
|
||||||
$build = [System.Environment]::OSVersion.Version.Build
|
$build = [System.Environment]::OSVersion.Version.Build
|
||||||
|
|
||||||
if (Test-Path -LiteralPath $binPath) {
|
|
||||||
Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
|
|
||||||
Add-Type -Path $binPath
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
|
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
|
||||||
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
|
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
|
||||||
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
|
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
|
||||||
|
|
||||||
$ctemp = "$env:SystemRoot\Temp\"
|
$ctemp = "$env:SystemRoot\Temp\$([Guid]::NewGuid().Guid)\"
|
||||||
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
|
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
|
||||||
$env:TMP = $ctemp
|
$env:TMP = $ctemp
|
||||||
$env:TEMP = $ctemp
|
$env:TEMP = $ctemp
|
||||||
|
|
||||||
$cp.GenerateInMemory = $true
|
$cp.GenerateInMemory = $true
|
||||||
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
|
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
|
||||||
|
|
||||||
|
try {
|
||||||
|
$cp.TempFiles.Dispose()
|
||||||
|
} catch {
|
||||||
|
# Older .NET Framework versions do not have that method, but they also don't create the folder that it removes.
|
||||||
}
|
}
|
||||||
|
Remove-Item -Path $ctemp
|
||||||
|
|
||||||
if ($env:_debug -eq '0') {
|
if ($env:_debug -eq '0') {
|
||||||
[LibTSforge.Logger]::HideOutput = $true
|
[LibTSforge.Logger]::HideOutput = $true
|
||||||
@@ -8947,7 +8960,7 @@ if (-not $env:resetstuff) {
|
|||||||
if ($env:tsmethod -eq "KMS4k") {
|
if ($env:tsmethod -eq "KMS4k") {
|
||||||
if ($build -ge 26100) {
|
if ($build -ge 26100) {
|
||||||
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
|
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
|
||||||
Write-Host "From build 26100.7019, Windows will always display and stay at 180 days remaining if the actual period is longer." -ForegroundColor White -BackgroundColor Darkgray
|
Write-Host "From build 26100.7019, Windows will always display a remaining activation period of 180 days in Settings." -ForegroundColor White -BackgroundColor Darkgray
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
|
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -479,6 +479,19 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "o_randguid="
|
||||||
|
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid" ^| findstr /r "^[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*$"') do set "o_randguid=%%G"
|
||||||
|
if not defined o_randguid (
|
||||||
|
set "o_randguid="
|
||||||
|
%eline%
|
||||||
|
echo Unable to generate GUID with PowerShell.
|
||||||
|
echo Aborting...
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
md "%SystemRoot%\Temp\%o_randguid%\"
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:oemenu
|
:oemenu
|
||||||
@@ -577,7 +590,7 @@ mode 98, 45
|
|||||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exist %SystemRoot%\Temp\%list%.txt (
|
if not exist %SystemRoot%\Temp\%o_randguid%\%list%.txt (
|
||||||
%eline%
|
%eline%
|
||||||
echo Failed to generate available editions list.
|
echo Failed to generate available editions list.
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
@@ -599,7 +612,7 @@ if %winbuild% LSS 10240 (
|
|||||||
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
||||||
) else (
|
) else (
|
||||||
for %%# in (2019 2021 2024) do (
|
for %%# in (2019 2021 2024) do (
|
||||||
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || (
|
find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\%list%.txt" %nul1% || (
|
||||||
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
|
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -608,7 +621,7 @@ if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this li
|
|||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%list%.txt) do (
|
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%o_randguid%\%list%.txt) do (
|
||||||
set /a counter+=1
|
set /a counter+=1
|
||||||
if !counter! LSS 10 (
|
if !counter! LSS 10 (
|
||||||
echo [!counter!] %%A
|
echo [!counter!] %%A
|
||||||
@@ -641,7 +654,7 @@ set suites=
|
|||||||
echo %list% | find /i "Suites" %nul1% && (
|
echo %list% | find /i "Suites" %nul1% && (
|
||||||
set suites=1
|
set suites=1
|
||||||
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
|
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
if not exist %SystemRoot%\Temp\getAppIds.txt (
|
if not exist %SystemRoot%\Temp\%o_randguid%\getAppIds.txt (
|
||||||
%eline%
|
%eline%
|
||||||
echo Failed to generate available apps list.
|
echo Failed to generate available apps list.
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
@@ -663,7 +676,7 @@ Visio
|
|||||||
Word
|
Word
|
||||||
) do (
|
) do (
|
||||||
if defined suites (
|
if defined suites (
|
||||||
find /i "%%#" "%SystemRoot%\Temp\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
|
find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
|
||||||
) else (
|
) else (
|
||||||
set %%#_st=
|
set %%#_st=
|
||||||
)
|
)
|
||||||
@@ -1287,11 +1300,11 @@ exit /b
|
|||||||
|
|
||||||
:oe_tempcleanup
|
:oe_tempcleanup
|
||||||
|
|
||||||
del /f /q %SystemRoot%\Temp\SingleApps_Volume.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\SingleApps_Volume.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\SingleApps_Retail.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\SingleApps_Retail.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\Suites_Volume.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\Suites_Volume.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\Suites_Retail.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\Suites_Retail.txt %nul%
|
||||||
del /f /q %SystemRoot%\Temp\getAppIds.txt %nul%
|
del %SystemRoot%\Temp\%o_randguid%\getAppIds.txt %nul%
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1445,7 +1458,7 @@ if ($windowsBuild -lt 9200) {
|
|||||||
:getlist:
|
:getlist:
|
||||||
$xmlPath1 = $env:_c2rXml
|
$xmlPath1 = $env:_c2rXml
|
||||||
$xmlPath2 = $env:_masterxml
|
$xmlPath2 = $env:_masterxml
|
||||||
$outputDir = $env:SystemRoot + "\Temp\"
|
$outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
|
||||||
$buildNumber = [System.Environment]::OSVersion.Version.Build
|
$buildNumber = [System.Environment]::OSVersion.Version.Build
|
||||||
$excludedKeywords = @("2019", "2021", "2024")
|
$excludedKeywords = @("2019", "2021", "2024")
|
||||||
$productReleaseIds = @()
|
$productReleaseIds = @()
|
||||||
@@ -1505,7 +1518,7 @@ foreach ($section in $categories.Keys) {
|
|||||||
:getappnames:
|
:getappnames:
|
||||||
$xmlPath = $env:_masterxml
|
$xmlPath = $env:_masterxml
|
||||||
$targetSkuId = $env:targetedition
|
$targetSkuId = $env:targetedition
|
||||||
$outputDir = $env:SystemRoot + "\Temp\"
|
$outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
|
||||||
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
|
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
|
||||||
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
|
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -35,6 +35,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -85,8 +97,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -95,10 +106,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -164,10 +173,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -176,7 +184,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -306,11 +314,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -827,8 +835,8 @@ exit /b
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G"
|
||||||
%nul% del /q /f %ddf%
|
set "ddf="%SystemRoot%\Temp\%Random%%randguid%""
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
echo/.set CabinetFileCountThreshold=0;>>%ddf%
|
echo/.set CabinetFileCountThreshold=0;>>%ddf%
|
||||||
@@ -1293,7 +1301,7 @@ if($false -eq ($installCandidates.Keys -contains $SetEdition)) {
|
|||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$xmlPath = $Env:SystemRoot + '\Temp' + '\CbsUpgrade.xml'
|
$xmlPath = $Env:SystemRoot + '\Temp' + "\$([Guid]::NewGuid().Guid)CbsUpgrade.xml"
|
||||||
|
|
||||||
Write-UpgradeXml -RemovalCandidates $removalCandidates `
|
Write-UpgradeXml -RemovalCandidates $removalCandidates `
|
||||||
-InstallCandidates $installCandidates[$SetEdition] `
|
-InstallCandidates $installCandidates[$SetEdition] `
|
||||||
|
|||||||
@@ -26,6 +26,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set "ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe"
|
set "ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe"
|
||||||
set "_psc=%ps% -nop -c"
|
set "_psc=%ps% -nop -c"
|
||||||
set "_err===== ERROR ===="
|
set "_err===== ERROR ===="
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -30,6 +30,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -80,8 +92,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -90,10 +101,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -175,10 +184,9 @@ goto done2
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -187,14 +195,14 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
echo You are most likely running the script directly from the archive file.
|
echo You are most likely running the script directly from the archive file.
|
||||||
echo:
|
echo:
|
||||||
echo Extract the archive file and launch the script from the extracted folder.
|
echo Extract the archive file and launch the script from the extracted folder.
|
||||||
goto done2
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -317,11 +325,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=3.11
|
@set masver=3.12
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -30,6 +30,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
cd /d "%SysPath%"
|
||||||
|
|
||||||
|
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
|
||||||
|
:: Changing %0 to something that is not quoted bypasses the issue.
|
||||||
|
goto arg_workaround_end
|
||||||
|
:arg_workaround
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
exit /b
|
||||||
|
:arg_workaround_end
|
||||||
|
|
||||||
|
call :arg_workaround
|
||||||
|
|
||||||
set re1=
|
set re1=
|
||||||
set re2=
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
@@ -80,8 +92,7 @@ cls
|
|||||||
|
|
||||||
:: Check LF line ending
|
:: Check LF line ending
|
||||||
|
|
||||||
pushd "%~dp0"
|
>nul findstr /v "$" "%_cmdf%" && (
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
|
||||||
echo:
|
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 LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
@@ -90,10 +101,8 @@ echo Check this webpage for help - %mas%troubleshoot
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
popd
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -176,10 +185,9 @@ goto dk_done
|
|||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
|
|
||||||
set "_batf=%~f0"
|
set "_batp=%_cmdf:'=''%"
|
||||||
set "_batp=%_batf:'=''%"
|
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%_cmdf%""" -el %_args%
|
||||||
set _PSarg=%_PSarg:'=''%
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
@@ -188,7 +196,7 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo The script was launched from the temp folder.
|
echo The script was launched from the temp folder.
|
||||||
@@ -318,11 +326,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
|
|||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
start conhost.exe "!_batf!" %_args% -qedit
|
start conhost.exe "!_cmdf!" %_args% -qedit
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
) else if %resetQE% EQU 1 (
|
) else if %resetQE% EQU 1 (
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
start cmd.exe /c ""!_cmdf!" %_args% -qedit"
|
||||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user