シャットダウンダイアログを開く( VBscript, Jscript, C#, C# in PowerShell, PowerShell, PHP, Python, Ruby )

ALT + F4



デスクトップをクリックまたは、デスクトップだけを表示してこのショートカットで開きます。Windows のアプリケーションは通常このショートカットで終了します。(タイトルバーの左上のアイコンをクリックするとメニューが表示されてその中にあります)



VBScript

Shell.ShutdownWindows method

Jscript

C# : VisualStudio
01.using System;
02. 
03.namespace ShutdownDialog
04.{
05.        class Program
06.        {
07.                static void Main(string[] args)
08.                {
09.                        dynamic shell = Activator.CreateInstance(Type.GetTypeFromProgID("shell.application"));
10.                        shell.ShutdownWindows();
11. 
12.                }
13.        }
14.}

PowerShell 内で C#
01.$code = @"
02.using System;
03.public class MyClass {
04.        public static void Main() {
05. 
06.                dynamic shell = Activator.CreateInstance(Type.GetTypeFromProgID("shell.application"));
07.                shell.ShutdownWindows();
08. 
09.        }
10.}
11."@
12. 
13.Add-Type -Language CSharp -TypeDefinition $code -ReferencedAssemblies ("Microsoft.CSharp")
14. 
15.[MyClass]::Main()

PowerShell のみ

PHP

Python
1.import win32com.client
2.shell = win32com.client.Dispatch("shell.application")
3.shell.ShutdownWindows()

pywin32 が必要なので、こちらを参照してください

Ruby