联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
reg add HKEY_CLASSES_ROOT\txtfile\shell\RunAsBat\command /ve /d "cmd /c copy \"%1\" \"%temp%\txt.bat\">nul & \"%temp%\txt.bat\"" /f
nircmd.exe exec show "~$clipboard$"
@echo off :其中将剪贴板的文本保存为text.bat的作者为清风——地址:http://bbs.verybat.org/viewthread.php?tid=11762 mshta vbscript:createobject("scripting.filesystemobject").opentextfile("text.bat",2,true).writeline(CreateObject("htmlfile").parentwindow.clipboarddata.getdata("text"))(window.close) ::start /w notepad text.bat start text.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
@copy %1 %~n1.cmd 1>nul @call %~n1.cmd @del /q %~n1.cmd 1>nul
Originally posted by 523066680 at 2009-9-8 08:53: 你说始终啊…… 关联成batfile 如果是看文本的话 右键-编辑 觉得不方便看文本的话,最多再改回去…… Last edited by 523066680 on 2009-9-8 at 08:57 ]