使用参数从.net运行cmd [英] Run cmd from .net with arguments

查看:71
本文介绍了使用参数从.net运行cmd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 http://www.coolutils.com/CommandLine / TotalCADConverter [ ^ ]工具将AutoCAD文件转换为图片。我写了下面的代码来从我的应用程序转换它然而没有任何反应只是打开cmd但没有为我做任何转换



I am trying to use http://www.coolutils.com/CommandLine/TotalCADConverter[^] tool to convert AutoCAD files to image. I wrote below code to convert it from my application however nothing happens it simply opens the cmd but didn't do any conversion for me

string args = @"/c 'C:\Program Files (x86)\TotalCADConverter\CADConverter.exe'
           'D:\truetype.dwg' 'D:\abc.svg'";
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new
 System.Diagnostics.ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.FileName = "cmd.exe";
startInfo.Arguments = args;
process.StartInfo = startInfo;
process.Start();

推荐答案

为什么不直接启动CADConverter?

Why not just start CADConverter directly?
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = @"C:\Program Files (x86)\TotalCADConverter\CADConverter.exe";
process.StartInfo.Arguments = @"D:\truetype.dwg D:\abc.svg";
process.Start();


这篇关于使用参数从.net运行cmd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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