没问题!我用的VBS文件,指定加载同目录下的Load.fas文件,全部代码如下: Dim WshShell, REG, Path, Key, SubKey, Value Set WshShell = WScript.CreateObject("WScript.Shell") 'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R17.0\ACAD-5001:409\Profiles\<<Unnamed Profile>>\Dialogs\Appload\Startup Boot = "HKCU\" Key = "Software\Autodesk\AutoCAD\" Value = WshShell.RegRead(Boot & Key & "CurVer") Key = Key & Value & "\" Value = WshShell.RegRead(Boot & Key & "CurVer") Key = Key & Value & "\" SubKey = "Profiles\" Value = WshShell.RegRead(Boot & Key & SubKey) SubKey = SubKey & Value & "\Dialogs\Appload\Startup\" Value = WshShell.RegRead(Boot & Key & SubKey) IF Value<>"" Then Set REG = GetObject("winmgmts:\\.\root\default:StdRegProv") Item = Value & "Startup" REG.GetStringValue &H80000001, Key & SubKey, Item, Value If IsNull(Value) Then Value = "" Else Value = WshShell.RegRead(Boot & Key & SubKey & Item) If UCase(Right(Value,9))<>"\LOAD.FAS" Then Value = "" End If End IF IF Value<>"" Then MsgBox "TB Tools 已在自动加载列表中!" Else Path = WshShell.CurrentDirectory & "\Load.fas" Value = WshShell.RegRead(Boot & Key & SubKey & "NumStartup") Value = CStr(CInt(Value)+1) WshShell.RegWrite Boot & Key & SubKey, Value, "REG_SZ" WshShell.RegWrite Boot & Key & SubKey & "NumStartup", Value, "REG_SZ" WshShell.RegWrite Boot & Key & SubKey & Value & "Startup", Path, "REG_SZ" 'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R17.0\ACAD-5001:409\Applications\AcadAppload Path = Boot & Key & "Applications\AcadAppload\LOADCTRLS" Value = WshShell.RegRead(Path) Value = Value or 2 WshShell.RegWrite Path, Value, "REG_DWORD" MsgBox "成功加入自动加载列表!" End IF
|