Hi !
The title is very explicit to show you how we can run a batch script as admin using Powershell in order to manage windows processes in command line and can be run from a batch file like that :
@echo off Title Run as admin using Powershell to manage windows Processes in command line by Hackoo 2020 If [%1] NEQ [Admin] Goto RunAsAdmin :Main Cls & color 0A Set "MyPID=" REM ================================================================================================= Powershell ^ Get-WmiObject Win32_Process ^ | Select-Object ProcessID,Caption,CommandLine ^ | Findstr /I /V "Get-WmiObject" Powershell ^ Get-WmiObject Win32_Process ^ | Select-Object ProcessID,Caption,CommandLine ^ | Out-String -Width 200 ^ | Findstr /I /V "Get-WmiObject" ^ | Out-File "%~dpn0.txt" -Encoding ASCII echo(================================================================================================ SET /P "MyPID=Please enter the Process ID number in order to kill its Application correspondante : " IF [%MyPID%] EQU [] GOTO Error cls & echo( Taskkill /PID %MyPID% /T /F If ErrorLevel 1 Color 0C Timeout /T 2 /NoBreak>nul & Goto Main ::--------------------------------------------------------------------------------------------------- :RunAsAdmin Powershell start -verb runas '%0' Admin & Exit ::--------------------------------------------------------------------------------------------------- :Error cls & echo( & Color 0C ECHO You did not enter a PID ???? Timeout /T 2 /NoBreak>nul & Goto Main ::---------------------------------------------------------------------------------------------------