我有这样的代码:C#不一致
string winpath = Environment.GetEnvironmentVariable("C:");
int i = 0;
Console.WriteLine("How much would you like to destroy your pc?");
i = Convert.ToInt32(Console.ReadLine());
int j = 0;
while (j < i)
{
Process.Start(winpath + @"\Windows\System32\calc.exe");
j++;
}
我希望让用户选择多少个计算器打开,我输入1,得到一个计算器,输入2,我仍然得到一个计算器,输入3并得到一个计算器,输入5得到2个计算器。我也尝试了for循环,但结果相同。
始终使用'Path.Combine'到Concat的你的路径字符串。 – LarsTech
另外,System32将会在搜索路径中,所以你只需要'Process.Start(“calc.exe”)'。 –
那么你的实际问题是什么?您的代码与您的要求不符,但您不会说什么是“不一致”。 – slugster