Pregunta

Tengo este archivo BAT "iARP.BAT"

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

Y estoy intentando pasar un nombre de archivo (en un bucle) como primer argumento y el nombre del dispositivo (variable previamente declarada) como segundo argumento.Estoy intentando hacer esto:

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();
}

Por cierto arpfiles = list, pero no se está ejecutando, ¿alguien puede ayudarme con esto?

¿Fue útil?

Solución

Debes especificarlos todos en el Arguments propiedad:

p.StartInfo.Arguments = string.Format("{0} {1}", argument1, argument2);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top