Domanda

Ho questo file di pipistrello "irp.bat"

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

e sto cercando di passare un nome di file (in un ciclo) come primo argomento e nome del dispositivo (variabile precedentemente dichiarata) come secondo argomento.Sto cercando di fare questo:

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= Elenco Ma non è in esecuzione, qualcuno può aiutarmi con questo?

È stato utile?

Soluzione

È necessario specificarli tutti nella proprietà Arguments:

p.StartInfo.Arguments = string.Format("{0} {1}", argument1, argument2);
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top