Solved A PowerShell question


TM21

Banned
Local time
7:51 PM
Posts
252
While writing my Win11Cleanup.bat program, I wanted a line of code that would empty out my Recycle Bin.
A most helpful member gave me this line:
PowerShell Clear-RecycleBin -DriveLetter C -force -ErrorAction:Ignore

It works GREAT on the little PC that I'm on now, (Running Windows 11/Pro/64, ver. 22H2, Build 22621.963.)
But, on another PC, that I just put together and installed the same ver. of Win-11 on, (from the same Flash Drive) that same line of code, in the same batch file does not empty the Recycle Bin at all. (n) I see a little flash on the screen when that line executes, but the Recycle Bin is NOT emptied.

So I guess my question is, "What gives?".
Is some 'Service' missing on the second PC?
And what can I do to get that line of code working as it should on the second PC?
Help! Help!

TM :cool:
 
I suggest you run that PS command in a PS window on its own to see what the response is.

I suspect the code came from Option 5 of
Empty Recycle Bin for all users - TenForumsTutorials
and I don't think there's an equivalent ElevenForum tutorial yet.

Best of luck,
Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.8037

My Computer My Computer

At a glance

W11 HomeIntel Core i9-13900KFDDR5 32GB (2x16GB) DDR5 4600RTX 4080 12GB
OS
W11 Home
Computer type
PC/Desktop
Manufacturer/Model
Build Date: March 2022
CPU
Intel Core i9-13900KF
Motherboard
ASUS Prime 690-P
Memory
DDR5 32GB (2x16GB) DDR5 4600
Graphics Card(s)
RTX 4080 12GB
Screen Resolution
1920 x 1080 (scaled 125%) (144Mhz Refresh Rate)
PSU
1000 Watt
Cooling
AIO
Internet Speed
1GB
Browser
Chrome and Edge
Antivirus
Malwarebytes Premium
I am not conversant in the use of Power Shell. I barely skate by with DOS Batch Files.

But,for that Power Shell command to run in a Batch File, what needs to be present. Something I'm obviously missing?
 
I've poked, prodded, and twiddled with that batch file, till I finally have it emptying the Recycle Bins, all of them. At least on that one PC.
And that one PC was the only one I was having problems with.
Thanks for all the helps.

TM :cool:
 
Back
Top Bottom