using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace WinFormProcess
{
public partial class FormProcess : Form
{
public FormProcess()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// 启动 SQL SERVER 服务器
//Process.Start("cmd.exe", @"/c net start MSSQLSERVER"); // "MSSQL$SQLEXPRESS"
//using (Process psi = new Process())
//{
// ProcessStartInfo info = psi.StartInfo;
// info.FileName = "cmd.exe";
// info.Arguments = @"/c net start MSSQLSERVER"; // start, pause, continue, stop
// info.WorkingDirectory = Environment.SystemDirectory;
// info.WindowStyle = ProcessWindowStyle.Normal;
// psi.Start();
//}
// 关闭计算机
//Process.Start("shutdown.exe", @"-s -f -t 0"); // 关机。
//using (Process psi = new Process())
//{
// ProcessStartInfo info = psi.StartInfo;
// info.FileName = "shutdown.exe";
// info.Arguments = @"-s -f -t 0"; // '-s' 关机,'-r' 重启,'-l' 注销, '-f' 强制,'-t' 限时。
// info.WorkingDirectory = Environment.SystemDirectory;
// info.WindowStyle = ProcessWindowStyle.Hidden;
// psi.Start();
//}
// 画图工具
//Environment.CurrentDirectory = Application.StartupPath;
//Image img = SystemIcons.WinLogo.ToBitmap();
//img.Save("Image.png", img.RawFormat);
//Process.Start("mspaint.exe", "Image.png");
//using (Process psi = new Process())
//{
// ProcessStartInfo info = psi.StartInfo;
// info.FileName = "mspaint.exe";
// info.Arguments = "Image.png";
// info.WorkingDirectory = Environment.CurrentDirectory;
// info.WindowStyle = ProcessWindowStyle.Maximized;
// psi.Start();
//}
// 打开应用程序
//Environment.CurrentDirectory = Application.StartupPath;
//System.IO.File.WriteAllText("NoteBook.txt", "记事本");
//Process.Start("notepad.exe", "NoteBook.txt");
//using (Process psi = new Process())
//{
// ProcessStartInfo info = psi.StartInfo;
// info.FileName = "Word.doc";
// info.WorkingDirectory = Environment.CurrentDirectory;
// info.WindowStyle = ProcessWindowStyle.Maximized;
// info.Verb = "Print";
// psi.Start();
//}
// 打开网页
//Process.Start("iexplore.exe", @"http://hi.baidu.com/kingzhexian/blog");
using (Process psi = new Process())
{
ProcessStartInfo info = psi.StartInfo;
info.FileName = "iexplore.exe";
info.Arguments = @"http://hi.baidu.com/kingzhexian/blog";
info.WindowStyle = ProcessWindowStyle.Maximized;
psi.Start();
}
Application.Exit();
}
}
}