Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用批处理文件或PowerShell清除Windows剪贴板?_Windows_Powershell_Batch File_Cmd_Clipboard - Fatal编程技术网

如何使用批处理文件或PowerShell清除Windows剪贴板?

如何使用批处理文件或PowerShell清除Windows剪贴板?,windows,powershell,batch-file,cmd,clipboard,Windows,Powershell,Batch File,Cmd,Clipboard,我有一个批处理文件,我的程序自动与剪贴板一起工作 但我想清除剪贴板并使用以下内容: echo>nul|clip 清除Windows剪贴板还有其他方法吗?嗯,最合乎逻辑的方法(至少在我看来),就是(这里是另一种方法。这似乎至少可以清除CF_文本和CF_位图。需要测试它是否清除所有CF_*类型 powershell -NoLogo -NoProfile -Command "Set-Clipboard -Value $null" 如果要使用Powershell执行此操作: Add-Type

我有一个批处理文件,我的程序自动与剪贴板一起工作

但我想清除剪贴板并使用以下内容:

echo>nul|clip

清除Windows剪贴板还有其他方法吗?

嗯,最合乎逻辑的方法(至少在我看来),就是(
这里是另一种方法。这似乎至少可以清除CF_文本和CF_位图。需要测试它是否清除所有CF_*类型

powershell -NoLogo -NoProfile -Command "Set-Clipboard -Value $null"

如果要使用Powershell执行此操作:

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Clipboard]::Clear()
批量

更多批量方式:

<nul set /p="" | clip
dir >nul | clip 
cd %cd% | clip
pushd %cd% | clip
cd >nul | clip

break | clip
(清除剪贴板中的文本;如果有图片(或可能是文本以外的任何对象)没有效果)(@aschipfl-your's不起作用(令人惊讶))那么
rem/| clip
起作用了吗?(目前无法测试,我在手机上)@aschipfl:抱歉,没有:
Der-Befehl“rem/”我是法尔施·格什里本·奥德·科恩特·格芬登·沃登。
(只是
rem/
,没有管道工程)谢谢,@Stephan!
(rem/)| clip
到时候就可以工作了;
失败是完全不合逻辑的,这是一个多么糟糕的设计!当使用powershell时,上面的命令都不起作用。我们应该使用cmd来运行这些命令。是的,@ToughMind,这是问题中的代码,或者与问题中的一样;其他答案已经提供了解决方案。。。
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")
IE.Document.ParentWindow.ClipboardData.SetData "text", ""
IE.Quit