如何使用c#console applicatiom运行bat文件命令 [英] How to run bat file commands using c# console applicatiom

查看:111
本文介绍了如何使用c#console applicatiom运行bat文件命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用c#console应用程序运行此bat文件命令



请帮助...



start noteapp.exe / stext noteapp.txt



启动wordapp.exe / stext wordapp.txt



和idont想要创建一个bat文件并使用c#application调用bate文件。我想从c#本身运行它

解决方案

看看 Process.Start [ ^ ]。


using System.Diagnostics;



class program

{

static void Main()

{

Process.Start(C:\ Users \ pant \Documents\myfile.bat);

}

}

i want to run this bat file commands using c# console application

please help...

start noteapp.exe /stext noteapp.txt

start wordapp.exe /stext wordapp.txt

And idont want to create a bat file and call the bate file using c# application. i want to run it from c# itself

解决方案

Take a look at Process.Start[^].


using System.Diagnostics;

class Program
{
static void Main()
{
Process.Start("C:\Users\pant\Documents\myfile.bat");
}
}


这篇关于如何使用c#console applicatiom运行bat文件命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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