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
@@ -30,6 +30,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"
@@ -80,8 +92,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:
@@ -90,10 +101,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo:
echo:
ping 127.0.0.1 -n 20 >nul
popd
exit /b
)
popd
::========================================================================================================================================
@@ -175,10 +184,9 @@ goto done2
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"
@@ -187,14 +195,14 @@ 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.
echo You are most likely running the script directly from the archive file.
echo:
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%
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
)