Open a minimized window by its title/path

Page 1 of 2 12 LastLast

  1. Posts : 7
    Windows 10
       #1

    Open a minimized window by its title/path


    Please tell me if there is any way to open a window that is minimized by its title or path in full screen?

    Anything like a batch file, etc.

    Windows 22H2
      My Computer


  2. Posts : 1,728
    Windows 10 Pro x64 22H2
       #2

    There is a ShowWindow API which takes parameter stating how the window is to be shown.

    For an example for PowerShell see here:
    powershell - How to bring focus to window by process name? - Stack Overflow

    To show minimized window as maximized replace number 9 with 3 in the posted code above, for instance:

    Code:
    $type::ShowWindow($hwnd, 9)

    Replace with this:
    Code:
    $type::ShowWindow($hwnd, 3) # SW_SHOWMAXIMIZED
    For other valid constants see:
    https://learn.microsoft.com/en-us/wi...ser-showwindow
      My Computer


  3. Posts : 7
    Windows 10
    Thread Starter
       #3

    zebal said:
    There is a ShowWindow API which takes parameter stating how the window is to be shown.

    For an example for PowerShell see here:
    powershell - How to bring focus to window by process name? - Stack Overflow

    To show minimized window as maximized replace number 9 with 3 in the posted code above, for instance:

    Code:
    $type::ShowWindow($hwnd, 9)

    Replace with this:
    Code:
    $type::ShowWindow($hwnd, 3) # SW_SHOWMAXIMIZED
    For other valid constants see:
    https://learn.microsoft.com/en-us/wi...ser-showwindow
    Thank you, it worked! Maybe you can tell me how to pin this script to the taskbar? Or, more precisely, how to pin it to open with one button without selecting "Run with PowerShell".
      My Computer


  4. Posts : 1,728
    Windows 10 Pro x64 22H2
       #4

    I think there is no way because it's not executable file.

    What you can do though is creating a shortcut and then setting a keyboard shortcut for the shortcut created.
    This way it's even faster and you don't even need a mouse.
      My Computer


  5. Posts : 7
    Windows 10
    Thread Starter
       #5

    zebal said:
    What you can do though is creating a shortcut and then setting a keyboard shortcut for the shortcut created.
    Ah, also an option, I'm just new at this and all the time this script opens in notepad, even if you create a shortcut, what am I doing wrong and how do I do it?

    it looks like I can't find the "right" Windows PowerShell to put a checkmark in Open With > Always use this app to open .ps1 files
      My Computer


  6. Posts : 1,728
    Windows 10 Pro x64 22H2
       #6

    go to:
    Start button -> settings -> Update & Security -> For developers

    Here under "File explorer" make sure all check boxes are checked and click "Apply"

    This will show you file extension, you need to make sure that your script file ends with *.ps1 extension and not with *.txt
    Then right click it an run with powershell.

    If you have no context menu to run powershell there are two methods around this:
    1. Install PowerShell core LINK and during installation make sure you enable "Run with powershell" context menu checkbox.

    2. another method is if you want to use Windows Powershell, follow one of the tutorials below (or both) to add context menu:
    Open PowerShell window here context menu - Add in Windows 10
    Add Open PowerShell window here as administrator in Windows 10
      My Computer


  7. Posts : 7
    Windows 10
    Thread Starter
       #7

    zebal said:
    go to:
    Start button -> settings -> Update & Security -> For developers

    Here under "File explorer" make sure all check boxes are checked and click "Apply"

    This will show you file extension, you need to make sure that your script file ends with *.ps1 extension and not with *.txt
    Then right click it an run with powershell.

    If you have no context menu to run powershell there are two methods around this:
    1. Install PowerShell core LINK and during installation make sure you enable "Run with powershell" context menu checkbox.

    2. another method is if you want to use Windows Powershell, follow one of the tutorials below (or both) to add context menu:
    Open PowerShell window here context menu - Add in Windows 10
    Add Open PowerShell window here as administrator in Windows 10
    I'm sorry, I guess I didn't make myself clear. I have button "Run with PowerShell" in context menu, and it works, the script works.

    I was wondering exactly how to make a hotkey shortcut with this script, and I gave an example that I cannot make a shortcut with this script, because when not running it through the context menu it does not work, could you tell me plase or give me a tutorial link on exactly how to make a hotkey to open a file *.ps1? (like not even to use the mouse to run it)
      My Computer


  8. Posts : 1,728
    Windows 10 Pro x64 22H2
       #8

    ah I'm sorry for confusion..

    right click shortcut to script -> properties -> shortcut
    Here into "Shortcut key" field enter your keyboard shortcut.

    Under "General" tab, in "Opens with" click on "Change" button and find powershell to set it as default.

    Windows Powershell is in C:\Windows\System32\WindowsPowerShell\v1.0\poweshell.exe
      My Computer


  9. Posts : 7
    Windows 10
    Thread Starter
       #9

    zebal said:
    ah I'm sorry for confusion..

    right click shortcut to script -> properties -> shortcut
    Here into "Shortcut key" field enter your keyboard shortcut.

    Under "General" tab, in "Opens with" click on "Change" button and find powershell to set it as default.

    Windows Powershell is in C:\Windows\System32\WindowsPowerShell\v1.0\poweshell.exe
    Okay, that worked, thanks a lot.
      My Computer


  10. Posts : 1,728
    Windows 10 Pro x64 22H2
       #10

      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 06:59.
Find Us




Windows 10 Forums