C# and DOS

Posted by Greendragons under C# on 9/30/2009 | Views : 2724 | Status : [Member] | Replies : 3
Hey is there any way i can write and run dos commands through my c# console applications.....and also i wanna convert my console application to an .exe file so that i can run it anywhere without deploying or installing.......actually im creating a batch file which i want to run on a certain date time...i dont know much of dos so decided to do with c#.I want that file to be created through dos using c# console application on certain date time.
Thnx.




Responses

Posted by: RtpHarry on: 9/30/2009 [Member] [MVP] Bronze

Up
0
Down
Hey a console mode app is kind of a dos program as in it looks like dos but you cant run it in dos, it has to be in windows.

When you compile it you will get an .exe in your project folder.

You can then schedule it to run at a certain time using Windows Task Scheduler.

http://en.wikipedia.org/wiki/Task_Scheduler


You can issue dos commands to the system by using Process.Start in the System.Diagnostics namespace:

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx

Greendragons, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Greendragons on: 9/30/2009 [Member] Starter

Up
0
Down
yeah ur right i used task scheduler using AT and gui mode both but not working.It shows the task is running but nothing actually happened.
By the way that exe gonna work same on every windows system?

Greendragons, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 10/1/2009 [Member] [MVP] Bronze

Up
0
Down
Is it looking for a relative path anywhere in your code? If the exe is run from a different location then it could be an incorrect path.

What are you trying to do?

Could you post the code for it at all?

Greendragons, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response