cmd执行调用打开文件
Process p = new Process();//新进程
p.StartInfo.FileName = "cmd.exe";//打开cmd程序
p.StartInfo.UseShellExecute = false;//不使用shell启动程序
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;//true表示不显示黑框,false表示显示dos界面
try
{
p.Start();//启动
p.StandardInput.WriteLine(@"cd\");
p.StandardInput.WriteLine(@"cd " + AppDomain.CurrentDomain.BaseDirectory + "ProWin" + "");//执行程序所在目录
p.StandardInput.WriteLine(@"" + AppDomain.CurrentDomain.BaseDirectory + @"ProWin\WindowsUI.exe" + "");//执行程序具体位置
p.StandardInput.WriteLine("exit");//退出
p.Close();//关闭
}
catch (Exception ex)
{
}
cmd执行调用打开文件的更多相关文章
- cmd执行超大sql文件
osql -S 127.0.0.1 -U sa -P 123456 -i d:\test.sql osql为SQL Server的命令,要在cmd中执行该命令,一般安装完SQL Server后该命令对 ...
- 如何用cmd通过sublime打开文件?
sublime 提供了专门的命令工具subl.exe,就在它的安装目录之下,讲安装目录配置到系统环境变量中就OK了.具体如下: 1.找到sublime安装路径 如我的默认路径:C:\Program F ...
- 在WPF中调用打开文件对话框
// Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); ...
- Delphi 实现最近打开文件记录菜单
unit UntOpenMenu; //download by http://wwww.NewXing.com interface uses Windows, Messages, SysUtils, ...
- java调用cmd执行maven命令
一.原理介绍 Java的Runtime.getRuntime().exec(commandStr)可以调用执行cmd指令. cmd /c dir 是执行完dir命令后封闭命令窗口. cmd /k di ...
- Windows执行打开文件命令
ShellExecute(NULL, "open", localFile.c_str(), NULL, NULL, SW_SHOW); 会调用该文件类型关联的 ...
- delphi调用外部程序打开文件
delphi调用外部程序打开文件 ShellExecute的各种用法 一.利用系统默认的邮件收发器发送电子邮件 Uses ..., ShellAPI; Var lpHwnd: HWND; lpOper ...
- ReactNative调用aar文件(附:如何打开、查看aar文件内容)
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/7275897.html ReactNative可以用来进行一些嵌入式设备的操作终端开发,比如:ATM机.自动售卖 ...
- bat文件调用cmd命令批量提取文件夹中的文件名(批量修改文件扩展名)
前言: 在平时的工作中,经常需要批量统计文件和数据,如果逐个统计的话太耗时,而且容易出错那么有没有什么快速的方法呢,这里给大家介绍一种简单高效的方法. 方法: 1.打开CMD命令: 按下 Ctrl+R ...
随机推荐
- Cracking the Coding Interview 10.7
Design an algorithm to find the kth number such that the only prime factors are 3,5 and 7 方法一: a[i]= ...
- String和八种基本数据类型互相转换
//String转换为对应的八种基本数据类型 String str="100"; //Value out of range. Value:"200" Radix ...
- bootstrap-paginator基于bootstrap的分页插件
bootstrap-paginator基于bootstrap的分页插件 GitHub 官网地址:https://github.com/lyonlai/bootstrap-paginator 步骤 引包 ...
- NuGet 下载dll
PM> Install-Package DotNetCore.CAP PM> Install-Package xxxdll
- php正则表达式应用
正则表达式 1.替换“/\d/”,“#”,$str:正则表达式\d 数字,替换为#,字符串 $str = "2hello 5li 6lei"; echo preg_replace( ...
- List 练习
(List)已知有一个Worker 类如下: public class Worker { private int age; private String name; private double sa ...
- C#屏蔽Alt+F4,解决Alt+F4关闭窗体时对话框NO后,线程不退出问题
//1.将窗体的属性KeyPrieview设置为true //keypreview属性为true的时候,就可以响应键盘事件v //2.在窗体KeyDown事件中加如下代码 private void F ...
- webapi部署到IIS 404错误
环境:win2008r2+IIS 解决方案: 添加一个映射 可执行文件地址(根据系统决定64位可32位): C:\Windows\Microsoft.NET\Framework64\v4.0.3031 ...
- python tips:作用域与名字空间
Python具有静态作用域,变量的作用域由它定义的位置决定,而与调用的位置无关. a = 2 def f(): a = 2 第一行的a的作用域是全局作用域,作用于定义位置后面的所有位置. 第四行的a的 ...
- 模拟人的手指在UI上滑动时3D模型跟随着移动(Unity)
问题: 怎么让当手指滑动的同时对应的模型发生旋转 解决办法: 1:通过控制摄像机或者模型来实现效果 2:通过获取鼠标移动时X轴Y轴的偏移量来确定模型的旋转角度 3:为了不让人感觉到突兀,建议使用Mat ...