This commit is contained in:
WitherOrNot
2026-07-04 03:48:39 -04:00
parent a9d539e763
commit f34d025d51
10 changed files with 273 additions and 232 deletions

View File

@@ -1,4 +1,4 @@
@set masver=3.11
@set masver=3.12
@echo off
@@ -43,6 +43,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
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 re2=
set "_cmdf=%~f0"
@@ -120,8 +132,7 @@ cls
:: Check LF line ending
pushd "%~dp0"
>nul findstr /v "$" "%~nx0" && (
>nul findstr /v "$" "%_cmdf%" && (
echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo:
@@ -130,10 +141,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo:
echo:
ping 127.0.0.1 -n 20 >nul
popd
exit /b
)
popd
::========================================================================================================================================
@@ -205,10 +214,9 @@ goto dk_done
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
set "_batp=%_cmdf:'=''%"
set _PSarg="""%~f0""" -el %_args%
set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''%
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!" (
%eline%
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%
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%
exit /b
) 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%
exit /b
)
@@ -2021,7 +2029,7 @@ set key=%%B
REM Generate ticket
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]))"
)