|
|
下载地址:http://www.xdowns.com/soft/38/121/2006/Soft_34310.html
'右键关联.VBS
'版权所有:福州子夜狂风
Function GetPath
'' Retrieve path to the script file
Dim path
path = WScript.ScriptFullName '' Script file name
GetPath = Left(path, InstrRev(path, "\")-1)
End Function
Dim WSHShell
WScript.echo "将要设置AutoIT 3的目录为:"&GetPath()
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCR\.AU3\","AutoIT3"
WSHShell.RegWrite "HKCR\AutoIT3\","AutoIT3程序文件"
WSHShell.RegWrite "HKCR\AutoIT3\Shell\Open\Command\",Chr(34)&GetPath()&"\AutoIt3.EXE"&Chr(34)&SPACE(1)&Chr(34)&"%1"&Chr(34),"REG_SZ"
WSHShell.RegWrite "HKCR\AutoIT3\Shell\Edit\","用SciTE编辑","REG_SZ"
WSHShell.RegWrite "HKCR\AutoIT3\Shell\Edit\command\",Chr(34)&GetPath()&"\SciTE\SciTE.EXE"&Chr(34)&SPACE(1)&Chr(34)&"%1"&Chr(34),"REG_SZ"
'因为目录中很可能有空格,会被解释为多个参数,所以要用CHR(34)给路径强行加上双引号;
'因为参数也可能是包含路径的文件名,所以也要做相同处理;
'程序与参数间要用SPACE(1)来加空格,直接在路径中加空格是行不通的,注册表里解释时会出错
MsgBOX "已经OK!"
WScript.Quit '' Terminate script.
[ 本帖最后由 UID 于 2007-3-30 11:30 AM 编辑 ] |
|