开发者

Output to DOS using C# in Visual Studio

I am using Visual Studio 2010 and I am trying to change the timen on my PC to 11 pm the ``day before yesterday. My question is can somebody tell me what statement that will allow ``me to output directly to DOS using C#.

Sorry for the poorly written question. I was trying to change the time to 11:50 two days ago. I am not familar with programming in Windows I have always used Linux. In linux I would execute my file from the command line and output to the command line. But using Visual Studio I was not sure if outputting to the command line would output to Visual Studio or MS DOS. If there is a way of changing the timecin this way I would appreciate it.

In command propt I entered date 28/07/2010 and it changed the date but when I entered Console.WriteLine("date 28/07/2010") into Visual Studio 2010 the time st开发者_Go百科ayed the same. Is this statement not outputting to the command prompt.

Thanks for any help


Console.WriteLine("Hello World!");

...assuming your application is started from the Command Line.

If you're trying to execute something from the command line (rather than outputing to the command line), then you want:

DateTime yesterdayAtEleven = 
    DateTime.Parse(DateTime.Now.AddDays(-1).Date.ToString("d") + " 11:00PM");
System.Diagnostics.Process.Start("date", yesterdayAtEleven.ToString());

System.Diagnostics.Process.Start


I believe this will work:

System.Diagnostics.Process.Start("time 23:59");


Not sure what you are asking, but if you made a Console app, you'd use System.Console.WriteLine

http://msdn.microsoft.com/en-us/library/system.console.writeline.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜