Set objShell = WScript.CreateObject("WScript.Shell") ' objShell.Run "runemacs.exe -q --load E:\WorkSpace\Emacs\init.el", 0, false ' 先获取vbs所在目录, 然后利用相对路径获取到Emacs初始文件 ' 目录结构 ' X:\BaiduSync\Emacs\init.el ' X:\Software\Emacs\bin\runemacs.exe ' X:\Software\Emacs\bin\emacs.vbs ' 获取当前运行脚本(emacs.vbs)的所在路径 scriptPath = WScript.ScriptFullName ' 根据脚本路径和约定的目录结构, 获取Emacs主程序及init.el文件路径 Set fso = WScript.CreateObject("Scripting.FileSystemObject") basePath = fso.GetParentFolderName(fso.GetParentFolderName(fso.getParentFolderName(scriptPath))) baiduSyncPath = fso.BuildPath(basePath, "BaiduSyncdisk") softwarePath = fso.BuildPath(basePath, "Software") emacsPath = fso.BuildPath(softwarePath, "Emacs\bin\runemacs.exe") initelPath = fso.BuildPath(baiduSyncPath, "Emacs\init.el") ' 启动Emacs Set objShell = WScript.CreateObject("WScript.Shell") objShell.Run emacsPath & " -q --load " & initelPath, 0, false