Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell desktop refresh

Trying to make it where powershell minimizes all windows, refreshes the desktop, then brings it back up. Thing is.. the desktop doesn't refresh after the windows minimize.

$shell = New-Object -ComObject "Shell.Application"
$shell.minimizeall()
start-sleep 1
$shell.sendkeys('{F5}')
start-sleep 1
$shell.undominimizeall()
exit
like image 567
dannyr.gez Avatar asked Apr 24 '26 14:04

dannyr.gez


1 Answers

You can use this:

$shell = New-Object -ComObject Shell.Application
$shell.minimizeall()
start-sleep 1
$wsh = New-Object -ComObject Wscript.Shell
$wsh.sendkeys('{F5}')
start-sleep 1
$shell.undominimizeall()
exit
like image 119
programmer365 Avatar answered Apr 27 '26 09:04

programmer365



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!