Close all open windows with one click.

Page 3 of 5 FirstFirst 12345 LastLast

  1. Posts : 17,661
    Windows 10 Pro
       #21

    Regarding my previous post, I realised that there's a catch in creating shortcuts for PowerShell commands, something that might go unnoticed if user is not familiar with it.

    So, the PowerShell command to close each and every application which is currently running is as told in my previous post:

    Get-Process | Where-Object {$_.MainWindowTitle -ne ""} | stop-process

    Notice that I have highlighted the pair of double quotes in the command with bold red font.

    Now, if you want to create a shortcut to run this command, you use syntax as follows:

    PowerShell -command "your PS command here"

    Your PowerShell command comes between double quotes. The thing is, command line interface misinterprets double quotes within double quotes and the command fails. When you run a PowerShell command like the one in this post from CLI, a shortcut, WIN + R or Command Prompt, you must change all double quotes in your PS command to single quotes, otherwise the command fails.

    So, in order to make this as a shortcut, or run it from WIN + R, you must change double quotes to single quotes. Use following command in shortcut (single quotes highlighted red):

    PowerShell -command "Get-Process | Where-Object {$_.MainWindowTitle -ne ''} | stop-process"

    Short: when run from PowerShell, use double quotes. When run from shortcut or WIN + R, use single quotes.

    Kari
      My Computer


  2. Posts : 17,838
    Windows 10
       #22

    Do you use a mouse?

    Get a programmable mouse and enable one button...

    Close all open windows with one click.-001346.png
      My Computer


  3. Posts : 17,661
    Windows 10 Pro
       #23

    Edwin said:
    Do you use a mouse?

    Get a programmable mouse and enable one button...
    Your solution is OK, as are those offered earlier in this thread if OP just wanted to hide / minimize all applications running.

    However, OP asked how to close everything:

    theoldfarter said:
    Is there a way, or program I can install, that will close everything on the screen with just one click of a keyboard key?

    Hiding / minimizing and closing are two totally different things. OP made it quite clear in his / her reply to one of these "Hide" suggestions:

    theoldfarter said:
    Yep, understand about the two key presses but that is not what I am after. There was a program many years ago the mapped the 'X' key to close all.

    The PowerShell shortcut solution I posted is as far as I know the only valid method to do exactly what OP was asking without any third party tools.

    Kari
      My Computer


  4. Posts : 181
    Windows 10 Pro. Version 10.0.19045 Build 19045
    Thread Starter
       #24

    Callender said:
    That's the one, I recognize that 'X'. lol
    I will look into the other offerings now :)
      My Computer


  5. Posts : 181
    Windows 10 Pro. Version 10.0.19045 Build 19045
    Thread Starter
       #25

    f14tomcat said:
    Ok.....if you just tap the Windows Key (one with the Windows Logo on it), it will instantly switch to the Start Menu. Desktop and all open windows are not visible. Hows that? It's ONE key. Not "X", but ONE key.
    That is a good suggestion but what was showing before is still underneath and when the 'other' pair of eyes says show me that photo that Miss A sent, the next click of the mouse will convict me. lol
      My Computer


  6. Posts : 181
    Windows 10 Pro. Version 10.0.19045 Build 19045
    Thread Starter
       #26

    Callender said:
    When I press the windows key it just launches a third party start menu.

    I just tried this and it seems to work:
    You map your own hotkey.

    WindowSpace 2.6.0 free download - Software reviews, downloads, news, free trials, freeware and full commercial software - Downloadcrew

    Free for personal use.
    Have bookmarked the link, thank you. I am going to have a shot at The PowerShell shortcut solution put forward by Kari. It is a tad confusing for me but nothing ventured, nothing learned.
      My Computer


  7. Posts : 181
    Windows 10 Pro. Version 10.0.19045 Build 19045
    Thread Starter
       #27

    Edwin said:
    Do you use a mouse?

    Get a programmable mouse and enable one button...

    Close all open windows with one click.-001346.png
    I just use a Microsoft Wireless Mouse 1000, with my Lenovo Legion Y520 laptop as the trackpad keeps on freezing randomly and needs a laptop reboot to work again. I live in NZ & Lenovo want to send it to Australia under warranty, which can take three weeks. Rather use a mouse, thank you. lol.

    I am thinking of getting another mouse and wonder if a programmable one like you mention, can map CLOSE, instead of HIDE to a button?
      My Computer


  8. Posts : 17,661
    Windows 10 Pro
       #28

    theoldfarter said:
    I am going to have a shot at the PowerShell shortcut solution. It is a tad confusing for me but nothing ventured, nothing learned.
    See Option Three in this tutorial: Create Shortcut to App, File, Folder, Drive, or Website in Windows 10 | Tutorials

    In Option Three Step 2 in above mentioned tutorial, use the following command:

    PowerShell -command "Get-Process | Where-Object {$_.MainWindowTitle -ne ''} | stop-process"

    That's it. Does exactly what you asked for.

    Kari
      My Computer


  9. Posts : 181
    Windows 10 Pro. Version 10.0.19045 Build 19045
    Thread Starter
       #29

    Kari said:
    Regarding my previous post, I realised that there's a catch in creating shortcuts for PowerShell commands, something that might go unnoticed if user is not familiar with it.

    So, the PowerShell command to close each and every application which is currently running is as told in my previous post:

    Get-Process | Where-Object {$_.MainWindowTitle -ne ""} | stop-process

    Notice that I have highlighted the pair of double quotes in the command with bold red font.

    Now, if you want to create a shortcut to run this command, you use syntax as follows:

    PowerShell -command "your PS command here"

    Your PowerShell command comes between double quotes. The thing is, command line interface misinterprets double quotes within double quotes and the command fails. When you run a PowerShell command like the one in this post from CLI, a shortcut, WIN + R or Command Prompt, you must change all double quotes in your PS command to single quotes, otherwise the command fails.

    So, in order to make this as a shortcut, or run it from WIN + R, you must change double quotes to single quotes. Use following command in shortcut (single quotes highlighted red):

    PowerShell -command "Get-Process | Where-Object {$_.MainWindowTitle -ne ''} | stop-process"

    Short: when run from PowerShell, use double quotes. When run from shortcut or WIN + R, use single quotes.

    Kari
    I want to try this Kari but have never done what you mention. I think I may have to use a 3rd party program as in the scenario I first posted, I was running a video player in full screen which meant I can not see/get to a shortcut so I need to map to a keyboard key. I had better map to a key I never use. My Lenovo Legion Y520 is a gaming one (I don't use it for Gaming, it had the Hardware I wanted inside) and has a key next to the right ALT key which has a symbol of a square with 3 horizontal bars inside it. I don't know what it is for and never use it so that's the one to map to. If I map to 'X' and am writing a letter when I press 'x' my letter closes. lol

    Can Powershell be mapped to a key?
      My Computer


  10. Posts : 17,838
    Windows 10
       #30

    @Kari
    How do you run it without having to right click on it?

    Close all open windows with one click.-001348.png
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 19:57.
Find Us




Windows 10 Forums