问题描述
您好,
如何使用c#.net以管理员身份运行bat文件?
我正在尝试此代码,但我的脚本没有使用c#运行。
我的脚本文件内容: -
Hello,
How to run bat file run as administrator using c# .net?
I am trying this code but my script is not running using c#.
My script bat file content:-
CD..
CD..
CD Program Files (x86)\ABC\ABC
TAKEOWN /F ABC_Data /R /A
当我以管理员身份手动运行时,此脚本正在运行。
This script is running when i have manually run as administrator.
Please help me.
先谢谢。
Ankit Agarwal
软件工程师
我尝试过:
ProcessStartInfo info = new ProcessStartInfo(Application.StartupPath + @\ script .bat);
info.UseShellExecute = true;
info.Verb =runas;
Process.Start(info);
Thanks in Advance.
Ankit Agarwal
Software Engineer
What I have tried:
ProcessStartInfo info = new ProcessStartInfo(Application.StartupPath + @"\Script.bat");
info.UseShellExecute = true;
info.Verb = "runas";
Process.Start(info);
推荐答案
这篇关于如何使用C#.NET以管理员身份运行bat文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!