先说明,我要调用一个.exe文件,调用命令如下:
LoadForecast forecast t1 t2 [list]
其中t1,t2为用户指定时间,但是格式有一定限制,例如2004年12月20日,必须是20041220
forecast表明功能是进行预测,[list]是所选方案的列表,共有7个,由用户选定,可以多选,比如用
方案1(id为schema001)和方案2(id为schema002)来预测2004年12月20日的负荷值,调用命令为
LoadForecast forecast 20041220 20041220 schema001 schema002我的程序如下:
private void loadForecastButton_Click(object sender, EventArgs e)
{
string strT1 = dateTimePicker1.Value.ToString("yyyymmdd");
string strT2 = dateTimePicker2.Value.ToString("yyyymmdd");
string str1 = "forecast";
string[] strSelect=new string[7];
for (int i = 0; i < 7; i++)
{
if (checkedListBox1.GetItemChecked(i))
{
int j = 0;
strSelect[j] = checkedListBox1.Items[i].ToString();
}
}
Process pro = new Process();
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.FileName = "d:\\LoadForecast.exe";
pro.StartInfo.Arguments = "str1"+"strT1"+"strT2"+"strSelect";
pro.StartInfo.CreateNoWindow = true;
pro.Start();
}
我运行完以后没有什么结果,不知道为什么
LoadForecast forecast t1 t2 [list]
其中t1,t2为用户指定时间,但是格式有一定限制,例如2004年12月20日,必须是20041220
forecast表明功能是进行预测,[list]是所选方案的列表,共有7个,由用户选定,可以多选,比如用
方案1(id为schema001)和方案2(id为schema002)来预测2004年12月20日的负荷值,调用命令为
LoadForecast forecast 20041220 20041220 schema001 schema002我的程序如下:
private void loadForecastButton_Click(object sender, EventArgs e)
{
string strT1 = dateTimePicker1.Value.ToString("yyyymmdd");
string strT2 = dateTimePicker2.Value.ToString("yyyymmdd");
string str1 = "forecast";
string[] strSelect=new string[7];
for (int i = 0; i < 7; i++)
{
if (checkedListBox1.GetItemChecked(i))
{
int j = 0;
strSelect[j] = checkedListBox1.Items[i].ToString();
}
}
Process pro = new Process();
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.FileName = "d:\\LoadForecast.exe";
pro.StartInfo.Arguments = "str1"+"strT1"+"strT2"+"strSelect";
pro.StartInfo.CreateNoWindow = true;
pro.Start();
}
我运行完以后没有什么结果,不知道为什么
{
string strT1 = dateTimePicker1.Value.ToString("yyyyMMdd");
string strT2 = dateTimePicker2.Value.ToString("yyyyMMdd");
string str1 = "forecast";
string strSelect="";
for (int i = 0; i < 7; i++)
{
if (checkedListBox1.GetItemChecked(i))
{
int j = 0;
strSelect += " " + checkedListBox1.Items[i].ToString();
}
}
Process pro = new Process();
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.FileName = "d:\\LoadForecast.exe";
pro.StartInfo.Arguments = str1 + " " + strT1 + " " + strT2 + strSelect";
pro.StartInfo.CreateNoWindow = true;
pro.Start();
}
//代码没测试过
AA%BB%CC……