Get Elevated .Bat File through Windows Terminal
This script succesfully start .ps1 file elevated through Windows Terminal
$Admin = (fltmc).count -eq 11
$arg = "-d `"$PSScriptRoot`" -p `"Windows PowerShell`"", "cmd /c powershell -ExecutionPolicy Bypass -File `"$PSCommandPath`""
if ( !$Admin ) { Start -Verb RunAs -FilePath "wt.exe" -ArgumentList $arg; taskkill /f /im $PID; exit }
if ( $Admin ) { 'Running with Admin privilages' } else { 'Required Admin privilages' }
Pause
Does anyone know how to run bat file with admin privilege through Windows Terminal?
This code get elevated in cmd.exe it self, not in/ through windows terminal
@echo off
Net session >nul 2>&1 || (PowerShell start -verb runas '%~0' &exit /b)
Echo Administrative privileges have been got. & pause
I want the batch file opened in windows terminal like screenshoot below:


Terminal is a "virtual machine" to run CMD, in reality, you're actually using CMD and its processes (see image below) with the key difference being the ability to handle some special characters (for example, emojis).
So there is no need to care about whether your script runs in Terminal or CMD, it's all the same (except if you like how Terminal looks, or, if you use special characters)