展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace NewForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//窗体隐藏,且不在任务栏显示
this.Hide();
this.ShowInTaskbar = false;
//获取系统默认浏览器
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
string s = key.GetValue("").ToString();
try
{ //尝试启动默认浏览器
System.Diagnostics.Process.Start(s.Substring(0, s.Length - 5));
}
catch
{ //如果启动不成功,启动IE
System.Diagnostics.Process.Start("iexplore.exe");
}
//关闭程序
this.Close();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace NewForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//窗体隐藏,且不在任务栏显示
this.Hide();
this.ShowInTaskbar = false;
//获取系统默认浏览器
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
string s = key.GetValue("").ToString();
try
{ //尝试启动默认浏览器
System.Diagnostics.Process.Start(s.Substring(0, s.Length - 5));
}
catch
{ //如果启动不成功,启动IE
System.Diagnostics.Process.Start("iexplore.exe");
}
//关闭程序
this.Close();
}
}
}
展开全部
System.Diagnostics.Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = "cmd.exe";
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.RedirectStandardInput = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.Start();
pro.StandardInput.WriteLine("iexplore.exe");//在这位里你需要写入执行命令行。。你的意思没有表达清楚啊
pro.StandardInput.WriteLine("exit");
这是通过c#调用cmd,用cmd调用ie的方法
pro.StartInfo.FileName = "cmd.exe";
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.RedirectStandardInput = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.Start();
pro.StandardInput.WriteLine("iexplore.exe");//在这位里你需要写入执行命令行。。你的意思没有表达清楚啊
pro.StandardInput.WriteLine("exit");
这是通过c#调用cmd,用cmd调用ie的方法
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询