Click here to Skip to main content
16,012,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,

A quick question here.

Actually I want to develop a console application which would read the commands which we enter into it and then in spite of writing the logic myself for those commands to execute, I want the OS command prompt to do it.

Is this possible?

Please help!!!

Example scenario :

I run my console app and i enter like "md sam". Now this will create a directory named sam in the current folder, but i need to write the code in my console app for it to do this by reading this
and may be write a switch case('md') then Directoryinfo.CreateDirectory(). something like this

But i just need to read the "md sam" by my console app and then send the command to OS command prompt and it will do the remaining things for us.

Is it possible??

Please help !!!!


Thanks!!
Sam
Posted
Comments
[no name] 7-May-13 7:52am    
Yes.... yes it is possible. Completely unnecessary, but possible.

You can do this (but why?) by using the Process.Start Method[^].
 
Share this answer
 
Comments
Sanman Marathe 7-May-13 10:51am    
Actually they asked me this question at my Microsoft interview.. i couldn't answer it... i didn't even expect such questions...
Richard MacCutchan 7-May-13 10:53am    
In interviews you should expect any question.
Sanman Marathe 8-May-13 3:16am    
lucky for me i answered all remaining one's and cleared the round. Having my next round in the coming week... !!
U have to define arguments what ever u pass to the console application and just the run the console application using command prompt by passing values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900