C#运行cmd外壳最小化 [英] C# run cmd shell minimized

查看:352
本文介绍了C#运行cmd外壳最小化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行从C#代码最小化的cmd shell.我该怎么办?
问题是当我尝试使用smd运行命令(例如安装驱动器)时,它将最大化打开控制台窗口,并且隐藏了我的应用程序窗体.它看起来不好,所以我想找到一种方法来最小化运行cmd.

我的代码是:

I need to run the cmd shell minimized from C# code. How can i do that?
The problem is when I try to run a command using smd (for example mounting of a drive) it opens console window maximuzed and it hides my application Form. It doesn''t look good, so I want to find a way to run the cmd minimized.

My code is:

mountingProcess = new Process();
mountingProcess.StartInfo.FileName = "net.exe";
string argument = "use \\\\" + serverIP + "\\ipc$ /user:" + domain + "\\" + user + " " + password;
mountingProcess.StartInfo.Arguments = argument;
mountingProcess.Start();



有人有一些想法怎么做吗?

谢谢!



Anybody have some ideas how to do it?

Thanks!

推荐答案

/user:"+域+" \\"+用户+""+密码; MountingProcess.StartInfo.Arguments =参数; MountingProcess.Start();
/user:" + domain + "\\" + user + " " + password; mountingProcess.StartInfo.Arguments = argument; mountingProcess.Start();



有人有一些想法怎么做吗?

谢谢!



Anybody have some ideas how to do it?

Thanks!


尝试
mountingProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;


它有效!
多谢! .
It works!
thanks a lot! .


这篇关于C#运行cmd外壳最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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