Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m Writing Code This...But When Execute This Then New Form Will Appeared..
C#
private void button1_Click(object sender, EventArgs e)
        {
            string ss = comboBox1.SelectedItem.ToString();
            if (ss.Equals("ShutDown"))
            {
                Process.Start("ShutDown.exe", "_s_t_00");
            }
            else
            {
                Process.Start("ReStart.exe", "_r_t_00");
            }
        }
Posted

Try in this way

C#
ProcessStartInfo startInfo = new ProcessStartInfo("ShutDown.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            
startInfo.Arguments = "_s_t_00";
            
Process.Start(startInfo);



Cheers!
 
Share this answer
 
v2
Try using -f in your parameters.
This will force a shutdown.

Warning - this will close all unsaved programs and all data will be lost.
 
Share this answer
 
v2

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