还有一个vbs的,怎么去掉它的弹窗???并在bat执行完毕后删除临时文件???
Option Explicit
dim strClipb
dim objIE
Dim WshShell,oExec
Set objIE = CreateObject("htmlfile")
strClipb=objIE.parentWindow.clipboardData.getData("text")
WScript.Echo strClipb
CreateBat strClipb
If strClipb = "" Then
Set objIE =Nothing
WScript.Quit
End If '剪贴板如果为空,不执行命令'
Set WshShell = CreateObject("WScript.Shell")
'Set oExec= WshShell.Exec("%comspec% /k _tempbat.bat") '这句CMD不能自动关闭
WshShell.Run("%comspec% /c call _tempbat.bat"),1, false '执行BAT, "pause"执行后退出
Set objIE =Nothing
Set WshShell =Nothing
Sub CreateBat(strCopy) '创建BAT文件
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("_tempbat.bat", True)
MyFile.WriteLine strCopy &vbcrlf& "pause" '在所有代码后加回车及"pause"
MyFile.Close
Set fso =Nothing
Set MyFile =Nothing
End Sub
[
Last edited by loquat on 2009-9-6 at 11:10 ]