运行具有管理员权限的cmd命令 [英] Running cmd commands with Administrator rights

查看:175
本文介绍了运行具有管理员权限的cmd命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows窗体的幕后运行命令 ** cd .. ** ? (即用户看不到它)

How can I run the command **cd..** behind the scenes of a Windows Form? (i.e. the user cannot see it)

感谢。

推荐答案

请参见System.Diagnostics.Process http://msdn.microsoft.com/en-us/ library / system.diagnostics.process.aspx

See System.Diagnostics.Process http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

这也是这个答案的确切问题: http://stackoverflow.com/a/1469790/25882

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
process.StartInfo = startInfo;
process.Start();

这篇关于运行具有管理员权限的cmd命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆