www.pudn.com > CopyDll.rar > Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace CopyDll
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string openPath;
private string savePath;
//目标文件
private void button1_Click(object sender, EventArgs e)
{
//SaveFileDialog vsf = new SaveFileDialog();
FolderBrowserDialog vf = new FolderBrowserDialog();
vf.ShowDialog();
this.textBox1.Text = vf.SelectedPath;
openPath = vf.SelectedPath;
}
//指定目录
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog vf = new FolderBrowserDialog();
vf.ShowDialog();
this.textBox2.Text = vf.SelectedPath;
savePath = vf.SelectedPath;
}
private void button3_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
MessageBox.Show("copy " + openPath + savePath);
p.StandardInput.WriteLine("copy " + openPath + " " + savePath);
}
}
}