Clear Items in Windows 10 Clipboard

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
 
May 20, 2008
11,845
120
Syracuse, NY, USA
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.
 

samintz

Scott Mintz
May 20, 2008
1,533
21
Solon, OH, USA
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?
 

Similar threads