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
Post a Comment