c# - Issue executing a command with cmd.exe -


i've got issue executing code:

process arp = new process(); arp.startinfo.useshellexecute = false; arp.startinfo.redirectstandardoutput = true; arp.startinfo.filename = "c://windows//system32//cmd.exe"; arp.startinfo.arguments = "arp -a"; arp.startinfo.redirectstandardoutput = true; arp.start(); arp.waitforexit(); string output = arp.standardoutput.readtoend(); messagebox.show(output); 

the program should put output of arp-a string output gives me instead:

microsoft windows [version 6.1.7601]\r\ncopyright (c) 2009 microsoft corporation. rights reserved.\r\n\r\nc:\users\user01\documents\visual studio 2012\projects\freehotspotexploiter\freehotspotexploiter\bin\debug>

someone knows how fix it?

in order send command cmd.exe argument, use "/c" flag.

arp.startinfo.arguments = "/c arp -a"; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -