Making CTRL+Z for Recycle Bin only restore deleted item - and in the background
Posted: 2023-Jan-26, 12:57 pm
I have this script
which executes the CTRL+Z on a Windows Explorer with opened Recycle Bin in its window. And I have two issues with it
#1] Aside from un-deleting last item[s] that was [or were] deleted, it also executes an un-move command- i.e. when the last action was not a deletion but movement. How can this be avoided? How to only restore items from Recycle Bin
#2] How to make this run in the background? If I change this to
then it does not work. I need either for the Windows Explorer window to be open minimized - or not opened at all, thus some potentially totally different script that will send to the operating system proper commands
I am using Windows 10 Enterprise 20H2 19042.746 x64
Code: Select all
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "explorer.exe shell:RecycleBinFolder", 9
WScript.Sleep 1111
WshShell.SendKeys "^z"
WshShell.SendKeys "%{F4}"
#1] Aside from un-deleting last item[s] that was [or were] deleted, it also executes an un-move command- i.e. when the last action was not a deletion but movement. How can this be avoided? How to only restore items from Recycle Bin
#2] How to make this run in the background? If I change this to
Code: Select all
WshShell.Run "explorer.exe shell:RecycleBinFolder", 7
I am using Windows 10 Enterprise 20H2 19042.746 x64