我想用C#写一个小程序,

2025-01-02 19:14:13
推荐回答(5个)
回答1:

打开应用程序.exe
System.Diagnostics.Process ps = new System.Diagnostics.Process();
ps.StartInfo.FileName = @"C:\Program Files\StormII\Storm.exe";//换成QQ.exe的路径就行了
ps.Start();
打开网站
string address = "http://地址";
System.Diagnostics.Process.Start("IEXPLORE.EXE",address);

回答2:

如果你只是为了快捷打开文件的话,那就像上面说的创建快捷方式,如果是玩程序的话给你个代码:
打开记事本: ProcessStartInfo MyStarInfo = new ProcessStartInfo();
MyStarInfo.FileName = "Notepad.exe";
Process MyProcees = new Process();
MyProcees.StartInfo = MyStarInfo;
MyProcees.Start();
打开网页: string address = "http://地址";
System.Diagnostics.Process.Start("IEXPLORE.EXE",address);

回答3:

///


/// 单击按钮事件
///

///
///
private void button1_Click(object sender, EventArgs e)
{

runProcess();
}
///
/// 设置程序信息
///

/// 程序物理地址
///
public static Process StartProcess(string fileName)
{
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = fileName;
return p;
}

///
/// 运行程序
///

private void runProcess()
{
//程序物理地址
string s = textBox1.Text;
Process process = StartProcess(@s);

process.Start();

//System.Threading.Thread.Sleep(59000);

//process.Kill();

//process.WaitForExit();
}
///
/// ie打开网页
///

///
///
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process ie = new System.Diagnostics.Process();
ie.StartInfo.FileName = @"C:\Program Files\Internet Explorer\IEXPLORE.EXE ";
ie.StartInfo.Arguments = "http://www.csdn.net ";
ie.Start();

}

回答4:

直接创建程序和网页快捷方式,何别做C#程序

回答5:

CS架构还是BS架构的呢?最好有详细的需求~不过感觉怎么简单的何必用C#写~多此一举