shutdown action [flags] [computer|command|threadname] [wait_|threadid] [message]
action - one of values below.
0 | Log off Windows. |
1 | Shut down Windows. |
2 | Restart Windows (reboot). |
3 | Shut down and power off. |
4 | Hibernate. |
5 | Suspend (sleep, standby). |
6 | Lock computer or switch user. |
-1 | Exit Quick Macros. In exe - exit the exe process (QM 2.2.0). |
-2 | Restart Quick Macros. |
-3 | Hide Quick Macros. |
-4 | Show Quick Macros. |
-5 | Reload current QM file. |
-6 | End currently running macro, or specified thread. Read more below. |
-7 | Softly end current thread. Read more below. |
Actions -2, -3, -4 and -5 not available in exe. RT error if used.
flags - see below. Depends on action. With other actions should be 0 or omitted. Default: 0.
action | flags | |
---|---|---|
0 - 5 | 0 | Applications are allowed to cancel the operation. For example, if an application shows a "Save?" message box, you can click Cancel to stop the shutdown. |
0 - 5 | 1 | Does not allow to cancel. When used with actions 0 - 3, forces all applications to terminate, which can cause them to lose data. This value also should be used if the computer is locked. |
0 - 3 | 2 | Forces to terminate only hung applications. |
-6 | 1-8 | Read in Remarks. |
-7 | 1 | End thread immediately. Read more in Remarks. |
These three parameters are used with action 1 and 2:
computer - computer name. Default: "" - this computer.
wait_ - time (seconds) to wait. A shutdown dialog box or other notification is displayed. Default: 0 (no dialog box).
message - text to display in the shutdown dialog. Default: "".
command - QM command line. Used with action -2 (restart QM). For example, it can be "V" to restart visible.
threadname - QM item name or id. Used with action -6 (end threads). Read more in Remarks.
threadid (QM 2.2.0) - thread handle, id or unique id (depends on flags). Used with action -6 (end threads). Read more in Remarks.
This command is asynchronous. It tells QM to perform the specified action but does not wait until the action is finished. With many actions, it should be the last command in the macro.
Use action -6 to end a thread. Read more.
Use action -7 to end current thread when you don't know if it has windows. Differently than end, it closes all thread's windows, giving them chance to free allocated memory, etc. When shutdown returns, windows are already destroyed. If flags is 1, ends thread immediately after destroying windows. If 0 - gives 0.5 s (or wait_ ms, if used) to finish naturally. This action for example can be used in a function that doesn't know how to properly end current thread.
Depending on operating system, hardware and security settings, some features may not work.
shutdown 3 ;;shut down; allow to cancel shutdown 2 1 ;;reboot; don't allow to cancel shutdown 1 0 "" 30 "QM" ;;shut down after 30 s shutdown -1 ;;exit QM shutdown -6 ;;end currently running macro shutdown -6 0 "Func" ;;end all threads (running instances) of function Func