From d55b9fa78c301672774a1fb4be13d55935871762 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 18 Aug 2024 05:08:35 +0530 Subject: [PATCH] Avoid using pause if Terminal is detected --- .../Check-Activation-Status.cmd | 17 +++++++++++++++-- MAS/Separate-Files-Version/Troubleshoot.cmd | 13 +++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/MAS/Separate-Files-Version/Check-Activation-Status.cmd b/MAS/Separate-Files-Version/Check-Activation-Status.cmd index 02bedad..a9ba6a4 100644 --- a/MAS/Separate-Files-Version/Check-Activation-Status.cmd +++ b/MAS/Separate-Files-Version/Check-Activation-Status.cmd @@ -6,10 +6,23 @@ :: https://gravesoft.dev/cas +:: Set Environment variables, it helps if they are misconfigured in the system + +setlocal EnableExtensions +setlocal DisableDelayedExpansion + +set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" + +set "SysPath=%SystemRoot%\System32" set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\" if exist "%SystemRoot%\Sysnative\reg.exe" ( +set "SysPath=%SystemRoot%\Sysnative" set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%" ) + +set "ComSpec=%SysPath%\cmd.exe" +set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" + set "_psc=powershell -nop -c" set "_err===== ERROR ====" set _pwsh=1 @@ -29,8 +42,8 @@ setlocal EnableDelayedExpansion :E_Exit echo. -echo Press any key to exit. -pause >nul +echo Press 0 key to exit. +choice /c 0 /n exit /b :sppmgr: diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index e35d102..eeaa116 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -829,10 +829,14 @@ echo: ) else ( echo: call :dk_color %_Yellow% "A Window will popup, in that Window you need to select [Quick] Repair Option..." +if defined terminal ( +call :dk_color %_Yellow% "Press 0 key to continue..." +choice /c 0 /n +) else ( call :dk_color %_Yellow% "Press any key to continue..." -echo: pause %nul1% ) +) if defined uwp16 ( echo: @@ -1042,8 +1046,13 @@ exit /b echo: echo %line% echo: -call :dk_color %_Yellow% "Press any key to go back..." +if defined terminal ( +call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." +choice /c 0 /n +) else ( +call :dk_color %_Yellow% "Press any key to %_exitmsg%..." pause %nul1% +) goto :at_menu ::========================================================================================================================================