C# net framework中的哪个库可用于执行程序?
我想编写一个具有以下功能的程序:C# net framework中的哪个库可用于执行程序?,c#,C#,我想编写一个具有以下功能的程序: 用户执行程序(C#中的控制台应用程序),键入程序名,然后按Enter键,程序应初始化。此功能内置于.NET核心,无需外部库: 请查看过程类。这应该让你开始,如果你有任何问题,发表另一个问题 以下是链接MSDN文档中的示例: using System; using System.Diagnostics; using System.ComponentModel; namespace MyProcessSample { class MyProcess
用户执行程序(C#中的控制台应用程序),键入程序名,然后按Enter键,程序应初始化。此功能内置于.NET核心,无需外部库:
请查看
过程
类。这应该让你开始,如果你有任何问题,发表另一个问题
以下是链接MSDN文档中的示例:
using System;
using System.Diagnostics;
using System.ComponentModel;
namespace MyProcessSample
{
class MyProcess
{
public static void Main()
{
Process myProcess = new Process();
try
{
myProcess.StartInfo.UseShellExecute = false;
// You can start any process.
// HelloWorld is a do-nothing example.
myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
// This code assumes the process you are starting will
// terminate itself.
//
// Given that is is started without a window so you cannot
// terminate it on the desktop, it must terminate itself
// or you can do it programmatically from this application
// using the Kill method.
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
就这一次,我给你密码。如果你想让你的发射器更复杂,那就由你决定了
class Program
{
public static void Main(string[] args)
{
Process process = new Process();
process.StartInfo.FileName = args[0];
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
}
}
我相信windows控制台可以做到这一点。