1

我有这个 BAT 文件“iARP.BAT”

Content Begin
@ECHO OFF
npg -vv -f %1 -d %2
Content End

我正在尝试将文件名(在循环中)作为第一个参数传递,将设备名称(先前声明的变量)作为第二个参数传递。我正在尝试这样做:

for (int i = 1; i < arpFiles.Count; i++) {

p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.WorkingDirectory = Application.StartupPath;
p.StartInfo.FileName = Application.StartupPath + "\\iARP.bat";
String argument1 = Application.StartupPath + "\\" + arpFiles[0].Name;
p.StartInfo.Arguments = argument1 + deviceName;
p.StartInfo.Verb = "runas";
p.StartInfo.CreateNoWindow = true;
p.Start();
}

BTW arpFiles = List 但它没有执行任何人都可以帮助我吗?

4

1 回答 1

5

您需要在属性中指定它们Arguments

p.StartInfo.Arguments = string.Format("{0} {1}", argument1, argument2);
于 2011-05-12T06:09:23.857 回答