以管理员身份运行另一个程序
因此,我尝试使用Google搜索,但是效果不理想。我想做的是以管理员身份运行另一个程序,而不会每次都弹出烦人的UAC。
So I tried Googling this and this does not get a good result. What Im trying to do is run another program as an administrator without that annoying UAC popping up everytime.
这个想法是这样的,该程序需要管理员特权才能运行用户将授予。然后,该程序将运行许多其他程序,这些程序也需要管理员权限。拥有管理员权限的程序无需用户单击即可允许大量程序运行,而是可以拥有管理员权限的其他程序,因为它本身具有管理员权限。
The idea is this, this program requires administrator privileges to run which the user will grant. Then this program will run a bunch of other programs that also require administrator permissions. Instead of the user clicking and allowing a bunch of programs time to time, the program with admin permissions can run the other programs as administrator since itself has it.
这样可以节省用户从以下方式到许多说明。同样,让程序要求用户允许很多东西看起来很不专业。
This would save the user from following way to many instructions. Also, having the program request the user to allow many things looks very unprofessional. Its just a one-click program that does it all.
我说Google收效不好的原因是因为页面上充斥着用户的运行方式他们的程序是管理员。我希望能够以管理员身份运行另一个程序。
The reason why I said Google is not getting a good result is because the page is flooded with how users can run their program AS an administrator. I want to be able to run another program as an admin.
我当时想将安装文件拖放到一个文件夹中,然后从CMD中以管理员身份运行这些文件,但这会要求我使用 runas
,并在对自己进行测试之后,一直说密码/用户名错误,但我确定是错误的。
I was thinking of dropping the setup files on a folder and then running the files as admin from CMD but it would require me to use runas
and after testing it on myself, it kept saying that the password/username was wrong yet I was sure it was.
还有其他提示吗?
您可以使用以下方法从应用程序中运行另一个应用程序:
You can run another application from your application by using:
Process.Start("Notepad.exe")
如果您的原始程序正在运行Elevated(以Admin身份运行),则记事本将以Admin身份运行(不会出现UAC提示符)
If your original program is running Elevated (As Admin), then Notepad will run As Admin (there will be no UAC prompt)
如果您的原始程序不是 运行提升的,并且您想以提升权限(以管理员身份)启动应用程序,则必须执行以下操作(这将提示提升):
If your original program is not running Elevated and you want to start an application elevated (As Admin) you will have to do something like this (this will prompt for elevation):
Dim procStartInfo As New ProcessStartInfo
Dim procExecuting As New Process
With procStartInfo
.UseShellExecute = True
.FileName = "Notepad.exe"
.WindowStyle = ProcessWindowStyle.Normal
.Verb = "runas" 'add this to prompt for elevation
End With
procExecuting = Process.Start(procStartInfo)
请注意,无法绕过UAC提示。如果启用了UAC,则用户必须在某个时候同意海拔高度。
Note that there is no way to circumvent the UAC prompt. If UAC is enabled then the user will have to agree to the elevation at some point.