其他分享
首页 > 其他分享> > 批处理脚本自我添加Run as administrator运行(UAC) 并含sleep

批处理脚本自我添加Run as administrator运行(UAC) 并含sleep

作者:互联网

@echo off
REM *******************************************
REM It is for ISO installation, kill the winSAT 
REM *******************************************
setlocal enabledelayedexpansion
color 2e
title Kill WinSAT
pushd %~dp0 & cd /d "%~dp0"
%1 %2
mshta vbscript:CreateObject("Shell.Application").ShellExecute("%~s0","goto :runas","","runas",1)(window.close)&goto :eof
:runas
for /L %%i in ('0 1 99') do ( echo ----%%i REM sleep 1 second choice /C YN /N /T 1 /D y>nul (tasklist /FI "IMAGENAME eq foo_installation_wizard.exe" /FI "STATUS eq running" /V /FO CSV | findstr "Running") && echo "find foo_installation wizard" && call :killSAT ) :killSAT (tasklist /FI "IMAGENAME eq WinSAT.exe" /FI "STATUS eq running" /V /FO CSV | findstr "Running") && echo "find WinSAT" && taskkill /f /im winSAT.exe :eof

 

标签:WinSAT,administrator,Run,echo,sleep,&&,REM,FI,eq
来源: https://www.cnblogs.com/qiyanse/p/16502086.html