문제

I have this BAT file "iARP.BAT"

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

And I'm trying to pass a file name (in a loop) as the first argument and device name (variable previously declared) as the second argument. I'm trying to do this:

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 but it is not executing can anyone help me with this?

도움이 되었습니까?

해결책

You need to specify them all in the Arguments property:

p.StartInfo.Arguments = string.Format("{0} {1}", argument1, argument2);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top