I have found 2 ways to use Powershell and .cmd files to minimize all windows, and show the desktop.
Each of the 2 methods work when I run either of them in a command prompt window in my Win 10 pro 64 bit pcs:
:: # https://devblogs.microsoft.com/scripting/powertip-use-powershell-to-display-the-desktop/
Rem Method #1
set _ShowDesktopPs1="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "(New-Object -ComObject shell.application).toggleDesktop()"
START "Show Desktop" /Min %_ShowDesktopPs1%
Rem Method #2
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "(New-Object -ComObject shell.application).toggleDesktop()"
But neither Method #1 nor Method #2 work (i.e., by minimizing all windows and showing the desktop), when I run them as two of last three lines of my boot-up script:
"C:\Documents and Settings\Marc\Start Menu\Programs\Startup\Desktop_startup_aaa.cmd - Shortcut.lnk"
The last line of my bootup script, Desktop_startup_aaa.cmd, is: "@ECHO Batch file execution completed."
I would appreciate any suggestions where I could find something that would help me understand why neither Method #1 nor Method #2 work (i.e., by minimizing all windows and showing the desktop), when I run them as two of last three lines of my boot-up script.
Alternatively, it'd be great if someone could tell me how to alter them so that they would minimize all windows and show the desktop.
Lastly, if I used the wrong tags for this question, please tell me what the right ones are; and if I posted this in the wrong forum, please tell me what the right one is, if you know.
Thank you for your help.
Marc