# Close

The **Close** command can be used to:

* Close Listers (either the current Lister or all)
* Collapse all open Listers to tabs in a single Lister
* Exit Directory Opus altogether
* Shutdown or restart the system immediately
* Schedule a system shutdown for some time in the future
* Automatically shutdown the system when all file operations are complete

**Command Arguments:**

| Argument        | Type | Possible values | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------------- | ---- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| _no argument_   | -    | -               | <p>Closes the active Lister. If the active Lister was the only one and the <strong>Shutdown Directory Opus when the last Lister closes</strong> option on the <a href="../../../preferences/preferences_categories/launching_opus"><strong>Launching Opus / Startup</strong></a> Preferences page is turned on, this will also exit the program.</p><p><em>Example:</em> <code>Close</code></p><p>This command is asynchronous. The Lister may not have closed yet when it completes. It should generally be the last command a button runs, as any later commands may fail to run if the window they are associated with has closed.</p>                                                 |
| ALLLISTERS      | /O   | _(no value)_    | <p>Closes all currently open Listers. The program will also exit if the <strong>Shutdown Directory Opus when the last Lister closes</strong> option is turned on. Add the <strong>CURRENTDESKTOP</strong> argument to only close the ones on the current virtual desktop.</p><p><em>Example:</em> <code>Close ALLLISTERS</code></p><p>This command is asynchronous. The Listers may not have closed yet when it completes. It should generally be the last command a button runs, as any later commands may fail to run if the window they are associated with has closed.</p>                                                                                                            |
|                 |      | **collapse**    | <p>Collapses all open Listers to tabs in a single Lister. All Listers except the active one will be closed, and tabs will be opened in the remaining Lister for every Lister that closed.</p><p><em>Example:</em> <code>Close ALLLISTERS=collapse</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                              |
|                 |      | **unique**      | <p>Combine <strong>unique</strong> with <strong>collapse</strong> to prevent duplicate tabs for paths which are already open in the lister. Has no effect unless <strong>collapse</strong> is also specified. At most one tab for each path will be opened in the left or right of the lister, with all other listers closing at the end as usual. Note that if the lister you are collapsing things into already has multiple tabs for the same folder, they will be left as-is, but no additional tabs will open for it.</p><p><em>Example:</em> <code>Close ALLLISTERS=collapse,unique</code></p>                                                                                      |
| ALLOTHERLISTERS | /S   | _(no value)_    | <p>Closes all open Listers <strong>except</strong> the active Lister. Add the <strong>CURRENTDESKTOP</strong> argument to only close the ones on the current virtual desktop.</p><p><em>Example:</em> <code>Close ALLOTHERLISTERS</code></p><p>This command is asynchronous. The Listers may not have closed yet when it completes.</p>                                                                                                                                                                                                                                                                                                                                                   |
| ALLVIEWERS      | /S   | _(no value)_    | <p>Closes any open <a href="../../../additional_functionality/viewing_images">standalone viewer</a> windows. Add the <strong>CURRENTDESKTOP</strong> argument to only close the ones on the current virtual desktop.</p><p><em>Example:</em> <code>Close ALLVIEWERS CURRENTDESKTOP</code></p><p>This command is asynchronous. The viewers may not have closed yet when it completes. If run from a button or hotkey inside the viewer, it should be the last line, as subsequent lines may not execute if the window they are associated with closes first.</p>                                                                                                                           |
| AT              | /K   | _\<HH:MM:SS>_   | <p>In conjunction with the <strong>SYSTEM</strong> argument this schedules an automatic shutdown of your system at a given time. The time to shutdown is given as a 24 hour time in HH:MM:SS format. If the time you specify is earlier than the current time of day, it will be taken to refer to the next day. When the time you specify is reached, a ten second countdown timer is displayed before the system it shutdown.</p><p><em>Example:</em> <code>Close SYSTEM=shutdown AT 04:00:00</code></p>                                                                                                                                                                                |
| AUTOLISTER      | /O   | _(no value)_    | <p>In conjunction with the <a href="prefs"><strong>Prefs RESTORE</strong></a> command, this argument sets a global flag that specifies that when Opus restarts, it should use "auto-Lister" semantics (which basically means that when Opus restarts, it will open a Lister by default).</p><p><em>Example:</em> <code>Close AUTOLISTER</code></p>                                                                                                                                                                                                                                                                                                                                        |
|                 |      | **no**          | <p>Disables "auto-Lister" semantics when Opus restarts.</p><p><em>Example:</em> <code>Close AUTOLISTER=no</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| CANCEL          | /S   | _(no value)_    | <p>If you have previously scheduled a system shutdown with the <strong>Close SYSTEM</strong> and** AT** or <strong>IN</strong> arguments, this argument will cancel it.</p><p><em>Example:</em> <code>Close CANCEL</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| CURRENTDESKTOP  | /S   | _(no value)_    | <p>When combined with <strong>ALLLISTERS</strong>, <strong>ALLOTHERLISTERS</strong>, or <strong>ALLVIEWERS</strong>, the <strong>CURRENTDESKTOP</strong> switch will make the command only close those windows which are on the currently active virtual desktop. (Virtual desktops are a feature of Windows 10 and above, so this argument has no effect on earlier versions.)</p><p><em>Example:</em> <code>Close ALLLISTERS=collapse CURRENTDESKTOP</code></p>                                                                                                                                                                                                                         |
| IN              | /K   | _\<HH:MM:SS>_   | <p>Schedules an automatic shutdown in a certain amount of time (contrast with <strong>AT</strong>, which lets you specify an absolute time of day). The time is specified in HH:MM:SS format (or MM:SS or just SS). When the time you specify is reached, a ten second countdown timer is displayed before the system it shutdown.</p><p><em>Example:</em> <code>Close SYSTEM=force,poweroff IN 60:00</code></p>                                                                                                                                                                                                                                                                          |
| NOSCRIPT        | /S   | _(no value)_    | <p>Closes the Lister without triggering the <a href="../../scripting_reference/scripting_events/oncloselister"><strong>OnCloseLister</strong></a> script events that any <a href="../../../scripting/script_add-ins">script add-ins</a> may have provided. You would probably want to use this if running the <strong>Close</strong> command from within an <strong>OnCloseLister</strong> event (to, e.g. close other Listers automatically in response to the user closing one).</p><p><em>Example:</em> <code>Close NOSCRIPT</code></p>                                                                                                                                                |
| PROGRAM         | /O   | _(no value)_    | <p>Exits Directory Opus immediately.</p><p><em>Example:</em> <code>Close PROGRAM</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|                 |      | **confirm**     | <p>Exits Directory Opus after displaying a confirmation dialog.</p><p><em>Example:</em> <code>Close PROGRAM=confirm</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|                 |      | **onlast**      | <p>Close the program only if this is the last remaining Lister, otherwise just close the Lister. This command lets you create a unified close/quit command.</p><p><em>Example:</em> <code>Close PROGRAM=onlast</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| QUIET           | /S   | _(no value)_    | <p>Suppresses the confirmation dialog normally displayed when shutting the system down with the <strong>Close SYSTEM</strong> command. The system will immediately shutdown - there will be no chance to cancel. You can also use this in conjunction with the scheduled shutdown arguments <strong>AT</strong> and <strong>IN</strong>.</p><p><em>Example:</em> <code>Close SYSTEM=shutdown QUIET</code></p>                                                                                                                                                                                                                                                                             |
| SYSTEM          | /O   | _(no value)_    | <p>Ends your Windows session and logs you off. A ten second countdown dialog will be displayed giving you a chance to cancel (unless you also use the <strong>QUIET</strong> argument).</p><p><em>Example:</em> <code>Close SYSTEM</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|                 |      | **restart**     | <p>Restarts (reboots) the system</p><p><em>Example:</em> <code>Close SYSTEM=restart QUIET</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|                 |      | **shutdown**    | <p>This shuts the system down (depending on your hardware, this may also power off the computer; or it may display the <em>"Your computer is now safe to be shutdown"</em> screen).</p><p><em>Example:</em> <code>Close SYSTEM=shutdown</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|                 |      | **poweroff**    | <p>This shuts the system down and powers off the computer.</p><p><em>Example:</em> <code>Close SYSTEM=poweroff</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|                 |      | **sleep**       | <p>Puts the system to sleep.</p><p><em>Example:</em> <code>Close SYSTEM=sleep</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
|                 |      | **suspend**     | <p>Suspends the system (S4 hibernation).</p><p><em>Example:</em> <code>Close SYSTEM=suspend</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|                 |      | **stay**        | <p>Stay running. If not specified, Directory Opus will exit at the same time Windows shuts down. Combine with <strong>sleep</strong> or <strong>suspend</strong> to make Windows sleep or hibernate without exiting Opus.</p><p><em>Example:</em> <code>Close SYSTEM=sleep,stay</code></p>                                                                                                                                                                                                                                                                                                                                                                                                |
|                 |      | **force**       | <p>Use this in addition to the other options to force the system to shutdown even if some programs are not responding. Normally the system will wait for all running programs to exit before shutting down. If you use this option the system will shutdown immediately and you may potentially lose unsaved data if some programs are currently busy.</p><p><em>Example:</em> <code>Close SYSTEM=shutdown,force AT 03:30:00 QUIET</code></p>                                                                                                                                                                                                                                             |
|                 |      | **forceifhung** | <p>This is the same as the <strong>force</strong> option, but only if there actually are any non-responding programs. Otherwise the shutdown proceeds as normal.</p><p><em>Example:</em> <code>Close SYSTEM=restart,forceifhung</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|                 |      | **switch**      | <p>If fast user-switching is enabled, this command will let you switch users. (This cannot be scheduled via the <strong>AT</strong> argument.)</p><p><em>Example:</em> <code>Close SYSTEM=switch</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|                 |      | **unattended**  | <p>System restart or shutdown will be done in a way which avoids additional confirmation dialogs when running via Remote Desktop or Terminal Services. The dialogs this avoids come from Windows itself; Opus will still show its own confirmation dialogs unless you also use the <strong>QUIET</strong> argument. If any applications, for any logged-in users, have unsaved work then system dialogs may still be generated unless you also use <strong>force</strong> or <strong>forceifhung</strong> (there is no distinction between the two when combined with <strong>unattended</strong>).</p><p><em>Example:</em> <code>Close SYSTEM=shutdown,force,unattended QUIET</code></p> |
| TOGGLE          | /S   | _(no value)_    | <p>Use this argument in conjunction with the scheduled-shutdown options to toggle the scheduled shutdown on or off. If used in a toolbar or menu it causes the button to appear checked whenever a shutdown is scheduled, and unchecked if not (providing a visual indication of the current state of the shutdown scheduler).</p><p><em>Example:</em> <code>Close SYSTEM=poweroff,force WHENFINISHED QUIET TOGGLE</code></p>                                                                                                                                                                                                                                                             |
| WHENFINISHED    | /S   | _(no value)_    | <p>Schedules an automatic shutdown when all outstanding file operations have completed. For example, when you are downloading a large amount of data via FTP, you could use this to have the computer automatically shutdown when the download is complete.</p><p>Note that if there are currently no executing functions, the shutdown will be triggered immediately!</p><p><em>Example:</em> <code>Close SYSTEM=shutdown WHENFINISHED</code></p>                                                                                                                                                                                                                                        |
