Ive developed small programs which were simple front end GUI for dos commands. While executing the programs, the dos console always popped up. This was very annoying, i wanted it not to appear and still execute the dos command.
I wanted to read the output of the dos command, execute the command without command window popping up.
The following code is about opening a "cmd" and executing a "ipconfig" command without window showing up from the console. This would be effective while executing the code from a Windows Form rather than.
I beleive that guys with basic .NET programming skill can understand this and PORT it to a windows FORM application.
the code goes as follows....
this code will open a invisible dos command window, execute the command and read the output into a string variable.
i have referred this post, before writing this small article
without dos window, execute dos commands
This was very helpful for something I'm working on. Thanks!
ReplyDeleteThanks a lot for this. I wanted a solution for java but i used the same concept and i was able to do it.
ReplyDeleteHi,
ReplyDeleteI want to open a console (cmd.exe), send some commands and read the output. Unfortunately everything res returns is:
"Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
E:\Projects\....>"
Do you know how to accomplish this task?
Thanks.