How to switch between two DPI scale values via hotkey?

Page 4 of 5 FirstFirst ... 2345 LastLast

  1. Posts : 758
    Windows 10/11
       #31

    avada said:
    Thanks again!
    So I guess I'll need a script then, since I can't contrive it into a .lnk, which I did until now.
    You can do it all within the shortcut. For example:

    Powershell -Command C:\Programs\SetDPI\SetDPI 125; Stop-Process -Force -ProcessName Explorer

    Obviously, change the path to where you put SetDPI. Note that when you paste this into a shortcut, Windows will automatically expand "PowerShell" to its full path.

    Note: I put all my portable apps in C:\Programs. That way, if the app needs to write a settings file, it stays right there with the app. Also note the lack of a space in the path makes creating shortcuts even simpler (I will never forgive Microsoft for putting spaces in System folder names, such as "Program Files" - such a totally brain-dead decision).
      My Computer


  2. Posts : 175
    10 22H2
    Thread Starter
       #32

    LesFerch said:
    You can do it all within the shortcut. For example:



    Obviously, change the path to where you put SetDPI. Note that when you paste this into a shortcut, Windows will automatically expand "PowerShell" to its full path.

    Note: I put all my portable apps in C:\Programs. That way, if the app needs to write a settings file, it stays right there with the app. Also note the lack of a space in the path makes creating shortcuts even simpler (I will never forgive Microsoft for putting spaces in System folder names, such as "Program Files" - such a totally brain-dead decision).
    Nice! Thanks!
    It takes a few seconds longer, but at least stuff appears correctly now.
      My Computer


  3. Posts : 17,049
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #33

    LesFerch said:
    A lot of people use TaskKill /im Explorer.exe /f in batch files (or pretty much any scripting language), but I've occasionally had some problems with that method (e.g. Explorer didn't always automatically relaunch). I've never had an issue with the PowerShell command.
    Les,

    If it's any help, I use
    Code:
    ::Stop explorer.exe
    taskkill /f /im explorer.exe
    :: This wait is to allow explorer to close fully before restarting it
    Timeout /t 3 >nul
    :: Start explorer.exe
    start explorer.exe

    All the best,
    Denis
      My Computer


  4. Posts : 758
    Windows 10/11
       #34

    Try3 said:
    If it's any help, I use
    Code:
    ::Stop explorer.exe
    taskkill /f /im explorer.exe
    :: This wait is to allow explorer to close fully before restarting it
    Timeout /t 3 >nul
    :: Start explorer.exe
    start explorer.exe
    Thanks Denis. I could have sworn that sometimes using TaskKill, Explorer would restart on its own, but it's not doing that now. Maybe I remembered incorrectly. Wouldn't be the first time.
      My Computer


  5. Posts : 17,049
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #35

    Les,

    I should have included
    Restart explorer.exe Process - TenForumsTutorials

    Oh, and there is a method of restarting explorer without losing File explorer windows. It involves running a PowerShell command [which can be done within a batch file].
    See KeithM updated restart explorer ditties [#42] - TenForums


    Denis
      My Computer


  6. Posts : 175
    10 22H2
    Thread Starter
       #36

    LesFerch said:
    You can do it all within the shortcut. For example:

    Powershell -Command C:\Programs\SetDPI\SetDPI 125; Stop-Process -Force -ProcessName Explorer
    I tried to extend this to:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command D:\Programok\SetDPI\SetDpi.exe 225; Stop-Process -Force -ProcessName Explorer; d:\Programok\cmdow\cmdow.exe "floating window" /mov 0 0

    Because the tuner program is buggy it's window gets off screen. So I added this command for this program to move it. However it doesn't seem to run, even if I add "Start-Sleep -Seconds 5" before it.
      My Computer


  7. Posts : 17,049
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #37

    The shortcut does not like that
    ;
    so replace it with a space then
    &
    then another space.

    Denis
      My Computer


  8. Posts : 175
    10 22H2
    Thread Starter
       #38

    Try3 said:
    The shortcut does not like that
    ;
    so replace it with a space then
    &
    then another space.

    Denis
    Hm. It worked for the second command, so I went with it. Anyway, I tried your suggestion, but with the change to "&" nothing runs whatsoever.
      My Computer


  9. Posts : 758
    Windows 10/11
       #39

    The semicolon is correct. It's separating each PowerShell command.

    Try changing "floating window" to 'floating window'. That is, use single quotes. That worked for me.

    Note that I tested with a different window. The name 'floating window' must exactly match the window name. You can do wildcard matching too, such as 'floating*'.
      My Computer


  10. Posts : 17,049
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #40

    Sorry, I thought the second part was not PowerShell.

    Denis
      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 15:14.
Find Us




Windows 10 Forums