|
|
发表于 2026-1-15 23:12:52
|
显示全部楼层
本帖最后由 aloha20200628 于 2026-1-23 13:27 编辑
回复 1# an1994114
以下批处代码调用 powershell 启运另一个外部脚本 1.bat(内容见最后代码段),其进程窗口被隐藏,powershell 命令行参数中若添加 -verb runas 即可采用提权模式
版本一。不采用提权模式启运外部脚本 1.bat
- @echo off
- powershell "start -file '1.bat' -arg 'test.txt' -win h"
- pause&exit/b
复制代码 版本二。采用提权模式启运外部脚本 1.bat
- @echo off
- powershell "start -file '1.bat' -arg 'test.txt' -verb runas -win h"
- pause&exit/b
复制代码 代码中被 powershell 调用的 1.bat 内容如下,其中 fltmc.exe 是系统内置程序,可用于测试当前进程是否已被提权 - 查看其定向输出的文件内容即可,输出文件与 1.bat 同目录,文件名由 powershell 命令行 -arg 第一个参数定义,以上代码中假设其为 'test.txt'
- @echo off
- fltmc>"%~dp0_%~1"
- exit/b
复制代码 |
|