I have a batch file and my program works automatically with the clipboard.
But I want to clear the clipboard and used this:
echo>nul|clip
Is there any other method for clearing Windows clipboard?
Here is another way to do it. This appears to clear at least CF_TEXT and CF_BITMAP. Needs testing to see if it clears all CF_* types.
powershell -NoLogo -NoProfile -Command "Set-Clipboard -Value $null"
Well, the most logical approach (at least in my opinion), that is to redirect (<) nothing (nul) to STDIN (handle 0) to the clip command, like < nul clip, does not work due to a terrible design of that command, because it seems that input redirection (<) can only be done with files.
So a pipe (|) needs to be used, which still allows several ways:
echo/> nul | clip
break | clip
(rem/) | clip
type nul | clip
goto | clip
call | clip
exit | clip
All of the above methods use a command on the left side of the pipe that do not output anything to STDOUT (handle 1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With