Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Clear Items in Windows 10 Clipboard

Aug
1,917
68
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  28.02.18 x64   Windows 10 [Version 10.0.19043.1586]

1647816738612.png

My goal is to clear all clipboard history from the Windows 10 clipboard via TCC.

Presently, I can only clear the most recent clipboard entry via TCC using;
Code:
echo off | clip

I can clear the entire clipboard history via the settings window;

1647817075150.png



...but I would like to do this via the Take Command Console.

Raymond Chen referred to the following links on how to accomplish this;
Clipboard.GetHistoryItemsAsync
Clipboard.DeleteItemFromHistory
Windows-universal-samples/Samples/Clipboard/

...but this is above my skill level.

Suggestions would be appreciated.

Joe
 
This works but it requires elevation.

Code:
echo off | clip
wmic service where "name like 'cbdhsvc_%%'" call stopservice
wmic service where "name like 'cbdhsvc_%%'" call startservice

You can get the user service suffix with @WMI and use SC.EXE (e.g., sc stop cbdhsvc_82a3d) but you'll still have to be elevated.
 
Thanks for that @vefatica

I combined that into a single command;
Code:
pshell /s "Restart-Service -Name "cbdhsvc*" -force"
...which resulted in...
1647838674485.png


Joe
 
Did it also get rid of the legacy-clipboard entry? I had to do that separately.
 
I just ran Restart-Service again, and you are correct, the legacy-clipboard entry was not removed.

Joe
 
Thanks for that @vefatica

I combined that into a single command;
Code:
pshell /s "Restart-Service -Name "cbdhsvc*" -force"
...which resulted in...
View attachment 3619

Joe
I tried that using PSHELL and it doesn't do anything. No errors, but doesn't clear the history either. This powershell command worked for me:
Code:
powershell -Command "& {Restart-Service -Name "cbdhsvc*" -force}"
Is there some trick to using PSHELL?
 
My issue was using -s instead of /s. Once I switched to /s it started working.
 

Similar threads

Back
Top