- imgpath="C:\BatHome.jpg" '在此位置输入你的图片绝对路径
- temphtm="temp.html"
- Set fso=CreateObject("scripting.filesystemobject")
- Set fs=fso.CreateTextFile(temphtm)
- fs.WriteLine "<Img Src='" & imgPath & "' id='TempImg'></img>"
- fs.Close
- Set fs=fso.GetFile(temphtm)
- Set ie=CreateObject("internetexplorer.application")
- ie.Navigate fs.path
- ie.Visible=False
- Do
- WScript.Sleep 100
- Loop Until ie.ReadyState=4
- Set ctrl = ie.document.body.createControlRange
- set oImg = ie.Document.getElementById("TempImg")
- oImg.contentEditable = true
- ctrl.add oImg
- ctrl.execCommand "Copy"
- oImg.contentEditable = false
- ie.Quit
- fs.Delete
-
- MsgBox "已经成功复制图片到剪切板"
复制代码 出自某VBS群 |