从vb.net中以管理员身份启动批处理文件 [英] start batch file from within vb.net as admin
本文介绍了从vb.net中以管理员身份启动批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我需要以管理员身份运行一个批处理文件才能使其正常运行.
到目前为止,我一直在使用它,但是我不记得如何使用runas功能,该功能允许它以管理员权限运行.
In my application, I need to run a batch file as admin for it to function.
I'm using this so far but I cant remember how to use the runas feature which allows it to run with admin rights.
process.start("filelocation.bat")
任何帮助将不胜感激.
推荐答案
Try
Dim procInfo As New ProcessStartInfo()
procInfo.UseShellExecute = True
procInfo.FileName = (FileLocation)
procInfo.WorkingDirectory = ""
procInfo.Verb = "runas"
Process.Start(procInfo)
Catch ex As Exception
MessageBox.Show(ex.Message.ToString())
End Try
这篇关于从vb.net中以管理员身份启动批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文