我正在运行带有命令/参数的runas,使用.bat和.vbs绕过SRP限制(仅用于教育),.vbs文件将隐藏命令窗口,如何在VB.Net或C#上编写此命令。我想让它成为一个独立的.exe文件,因为我也不允许使用SRP的命令提示符和机器中的VBScript。
HideBat.vbs
CreateObject("Wscript.Shell").Run "run.bat", 0, Truerun.bat
@ ECHO OFF
runas /trustlevel:"Unrestricted" "C:\Program Files\Deluge\deluged.exe"这就是我到目前为止得出的结论。
Dim myprocess As New System.Diagnostics.Process()
myprocess.StartInfo.FileName = Path.Combine(GetFolderPath(SpecialFolder.System), "runas.exe")
myprocess.StartInfo.Arguments = "/trustlevel:"Unrestricted"" & " " & "c:\program.exe"
myprocess.Start()由于引号,Unrestricted上有一个问题。
发布于 2014-03-28 17:05:11
假设C# (我不知道你为什么把它标记为VB.NET和C#)
Process myprocess = new Process();
myprocess.StartInfo.FileName = Path.Combine(GetFolderPath(SpecialFolder.System), "runas.exe");
myprocess.StartInfo.Arguments = "/trustlevel:\\\"Unrestricted\" \"C:\\Program Files\\Deluge\\deluged.exe\"";
myprocess.Start();使用反斜杠转义字符串中的双引号。
更新的答案-忘记反斜杠在路径中的反斜杠。
https://stackoverflow.com/questions/22718973
复制相似问题