c# 执行dos命令问题
大家帮我看看问题出在哪里,执行完后,一点效果也没有。(应该弹出dos出口才对)
string fileName = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "moveuser.exe");
ProcessStartInfo expressStartInfo = new ProcessStartInfo();
expressStartInfo.FileName =fileName;
expressStartInfo.Arguments = txtSource.Text.Trim() + " " + txtPurPose.Text.Trim() + " " + "/y/k";
expressStartInfo.CreateNoWindow = true;
expressStartInfo.RedirectStandardError = true;
expressStartInfo.RedirectStandardInput = true;
expressStartInfo.RedirectStandardOutput = true;
expressStartInfo.UseShellExecute = false;
using (Process expressProc = new Process())
{
expressProc.StartInfo = expressStartInfo;
expressProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
expressProc.Start();
//expressProc.WaitForExit();
}
string fileName = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "moveuser.exe");
ProcessStartInfo expressStartInfo = new ProcessStartInfo();
expressStartInfo.FileName =fileName;
expressStartInfo.Arguments = txtSource.Text.Trim() + " " + txtPurPose.Text.Trim() + " " + "/y/k";
expressStartInfo.CreateNoWindow = true;
expressStartInfo.RedirectStandardError = true;
expressStartInfo.RedirectStandardInput = true;
expressStartInfo.RedirectStandardOutput = true;
expressStartInfo.UseShellExecute = false;
using (Process expressProc = new Process())
{
expressProc.StartInfo = expressStartInfo;
expressProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
expressProc.Start();
//expressProc.WaitForExit();
}
...全文
相关推荐
C#写入DOS命令执行Windows关机重启等命令
总之,使用C#执行DOS命令是Windows开发中常见的一种技术手段。它可以帮助我们实现诸如系统关机、重启等高级操作,同时也需要注意处理好权限问题和用户体验。
C#模拟Dos命令
**安全性和权限管理**: 在执行DOS命令时,需要考虑安全问题,确保只执行预期的、安全的操作。同时,可能需要处理权限问题,特别是涉及到文件系统操作或系统级别的命令时。7.
执行DOS命令 c#
这个强大的功能允许程序在运行时与操作系统进行交互,执行各种系统级任务,比如文件操作、系统信息查询等。下面将详细阐述如何在C#中执行DOS命令以及相关的知识点。
JAVA执行DOS命令分析
**Java与C#调用DOS命令的对比**: 在Java和C#中调用DOS命令的方式略有不同。
C# 使用Dos命令实现关机和重启
在C#编程环境中,我们可以利用操作系统提供的API或者系统命令来执行一些系统级操作,比如关机和重启。本文将详细讲解如何使用C#通过DOS命令实现这些功能。


