this is my first post here so forgive me for my mistakes. I'm currently developping a program for myself. It is a C# winform app. You just fill the hours/minutes/seconds input and I then want it to shutdown the computer at that given amount of time later. So I coded the basics to convert the amount of time in seconds ( as the batch only accepts seconds ). I even ran the .exe in a windows 10 virtual machine but There's a problem with my call :
private void btnValidate_Click(object sender, EventArgs e)
{
seconds = convertToSeconds();
Process.Start("shutdown", "/s /t " + seconds);
}
Calling this function just run another instance of this .exe. at first, I thought it was because adding "+ seconds" was wrong and there was another way of doing it but even cancelling the shutdown with this code runs another instance of the .exe :
private void button1_Click(object sender, EventArgs e)
{
long seconds = 0;
DateTime shutdownDate = default(DateTime);
Process.Start("shutdown", "/a");
}
Here is a screenshot of the app if you didn't understand how it works : http://puu.sh/qkUi0/f2c1ad00ad.png
Thanks in advance for helping me.