获取本机office可执行文件路径
使用方法:执行脚本,按下`+1是word.exe的路径,`+2是excel.exe的路径,`+3是ppt.exe的路径。
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
getofficeexe(z){ ;获取本机office可执行文件的路径
prg:=Object(1,"C:\Program Files",2,"C:\Program Files (x86)",3,"C:\Program Files",4,"C:\Program Files (x86)")
ver:=Object(1,16,2,15,3,14,4,12,5,11)
officeexe:=Object(1,"WINWORD.EXE",2,"Excel.exe",3,"POWERPNT.EXE")
for i,v in prg
for m,n in ver
for o,x in officeexe
IfExist, %v%\Microsoft Office\OFFice%n%\%x%
{
if(o=z)
return v "\Microsoft Office\Office" n "\" x
}
}
` & 1::MsgBox % getofficeexe(1) ;word.exe路径
` & 2::MsgBox % getofficeexe(2) ;excel.exe路径
` & 3::MsgBox % getofficeexe(3) ;ppt.exe路径
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


读取注册表是不是更方便?