|
-
October 15th, 2010, 12:43 AM
#1
need help with a shutdown tool in c#
i have this little idea about a little piece of software i would like to try to create, becouse i did the same one in visualbasic some time ago, and now that i'm trying to learn c# i would love to try how the same stuff will work there.
the idea is pretty simple.
the program will start a shutdown command which turns off or hibernates your computer(depends on choice). but the problem is, in vb you can use the "shell" command to run commands from the cmd. thats not a part of c# as far i know, so i have roamed around on the internet getting other ideas. now it seems that the easiest way is to make the program create a .bat file with the needed command.
for those not knowing this the shutdown command work like this:
eg.
shutdown /s /t 3600 /f
shutdown is the command, /s is the shutdown not hibernate etc parameter, /t xx is the timecommand, tell the number of seconds it should wait before executing the command, and /f is the force comman, forcing any software running to shutdown without warning when the computer closes.
http://www.csharp-station.com/HowTo/...eTextFile.aspx
on this page i found a way to make it create and ready files, thats the wway i espect doing this, and later when it have created the .bat file with the chosen parameters, it will execute it, and delete it afterwards.
now to the problems:
since im still a c# newbie i would like to know the following.
how to make the writefile part write a text in the file changed by parameters.
in the form i have created 3 textboxes, meant for insetting the hours, minutes, and seconds you wanna wait. how to make all those count themselves up to a single number in seconds
last thing is how do i make all this happen when i press a single button?
and last thing is, when the .bat file is writen and run. how do i make it delete the exact moment it have been read?
-
October 15th, 2010, 01:06 AM
#2
Re: need help with a shutdown tool in c#
Actually there is a sort of shell command in C#
lookup "System.Diagnostics.Process" on google
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|