小白龙 当前离线
少尉
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit复制代码
77七 当前在线
中校
TOP
aloha20200628 当前在线
上尉
@echo off & if "%~1"=="" (powershell "start -filepath """%~f0""" -argumentList 1 -verb runas")&exit/b :: ... 批处脚本原代码在此 ... pause&exit/b复制代码
WHY 当前离线
上校
@echo off %1 PowerShell "Start-Process CMD -Args '/c', '\"\"%~f0\"', 'rem\"' -Verb RunAs" & exit/b echo;do something here. pause复制代码
<# : @echo off %1 PowerShell "Start-Process CMD -Args '/c', '\"\"%~f0\"', 'rem\"' -Verb RunAs" & exit/b PowerShell "type -Literal '%~f0'|out-string|iex" & pause & exit/b #> echo Done复制代码
@echo off more +4 "%~f0" > "%~dpn0.ps1" PowerShell "Start-Process PowerShell -Args ('-exec Bypass -file ' + [char]34 + '%~dpn0.ps1' + [char]34) -Verb RunAs" & exit/b echo Done [Console]::ReadLine()复制代码