![autoit 创建发送 ' type o.txt | clip ' 的批处理不起作用](https://linux22.com/image/1613302/autoit%20%E5%88%9B%E5%BB%BA%E5%8F%91%E9%80%81%20'%20type%20o.txt%20%7C%20clip%20'%20%E7%9A%84%E6%89%B9%E5%A4%84%E7%90%86%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我花了几个小时查阅文档和论坛来尝试解决这个问题。
代码运行时没有错误,但批处理脚本没有执行。
我没有向读者展示该#include<*>
部分,因为它太冗长了。
oToClip()
Func oToClip()
Local $sleep = 250
Sleep($sleep)
Local $sFilePath = "%userprofile%\oToClip.bat"
Sleep($sleep)
Local $hFileOpen = FileOpen($sFilePath, $FO_APPEND + $FO_CREATEPATH)
If $hFileOpen = -1 Then
MsgBox($MB_SYSTEMMODAL, "", "An error occurred when opening the file.")
EndIf
Sleep($sleep)
FileWriteLine($hFileOpen, "type %userprofile%\o.txt | clip")
Sleep($sleep)
FileClose($hFileOpen)
Sleep($sleep)
RunWait(@ComSpec & " /c " & $sFilePath)
EndFunc ;==>oToClip
答案1
如果你使用' "command" | clip'
?
‘类型“%userprofile%\o.txt"|剪辑‘
oToClip()
Func oToClip()
Local $sleep = 250
Sleep($sleep)
Local $sFilePath = "%userprofile%\oToClip.bat"
Sleep($sleep)
Local $hFileOpen = FileOpen($sFilePath, $FO_APPEND + $FO_CREATEPATH)
If $hFileOpen = -1 Then
MsgBox($MB_SYSTEMMODAL, "", "An error occurred when opening the file.")
EndIf
Sleep($sleep)
FileWriteLine($hFileOpen, 'type "%userprofile%\o.txt"|clip')
Sleep($sleep)
FileClose($hFileOpen)
Sleep($sleep)
RunWait(@ComSpec & " /c " & $sFilePath)
EndFunc ;==>oToClip