zfsaaa 发表于 2009-8-5 21:53:00

能否将下列程序改为非同目录下运行?

本帖最后由 作者 于 2009-8-6 8:15:22 编辑 <br /><br /> <p>Dim WS, REG, Path, Key, SubKey, Value, el, flag<br/>Set WS = WScript.CreateObject("WScript.Shell")<br/>Path = WS.CurrentDirectory &amp; "\Load.fas"<br/>Set REG = GetObject("winmgmts:\\.\root\default:StdRegProv")<br/>HKCU = &amp;H80000001<br/>HKLM = &amp;H80000002<br/>Key = "Software\Autodesk\AutoCAD"<br/>REG.GetStringValue HKCU, Key, "CurVer", Value<br/>Key = Key &amp; "\" &amp; Value<br/>REG.GetStringValue HKCU, Key, "CurVer", Value<br/>Key = Key &amp; "\" &amp; Value<br/>SubKey = "\Profiles"<br/>REG.GetStringValue HKCU, Key &amp; SubKey, "", Value<br/>SubKey = SubKey &amp; "\" &amp; Value &amp; "\Dialogs\Appload\Startup"<br/>REG.EnumValues HKCU, Key &amp; SubKey, Item, Value<br/>If IsNull(Item) Then<br/>&nbsp; REG.CreateKey HKCU, Key &amp; SubKey<br/>&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "", "1"<br/>&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "NumStartup", "1"<br/>&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "1Startup", Path<br/>&nbsp; SubKey = "\Applications\AcadAppload"<br/>&nbsp; REG.CreateKey HKCU, Key &amp; SubKey<br/>&nbsp; REG.GetStringValue HKLM, Key &amp; SubKey, "DESCRIPTION", Value<br/>&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "DESCRIPTION", Value<br/>&nbsp; REG.GetStringValue HKLM, Key &amp; SubKey, "LOADER", Value<br/>&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "LOADER", Value<br/>&nbsp; REG.GetDWORDValue HKLM, Key &amp; SubKey, "LOADCTRLS", Value<br/>&nbsp; Value = Value or 2<br/>&nbsp; REG.SetDWORDValue HKCU, Key &amp; SubKey, "LOADCTRLS", Value<br/>&nbsp; MsgBox "成功加入自动加载列表!"<br/>Else<br/>&nbsp; REG.GetStringValue HKCU, Key &amp; SubKey, "", Value<br/>&nbsp; flag = False<br/>&nbsp; If Not IsNull(Value) Then<br/>&nbsp;&nbsp;&nbsp; Item = Value &amp; "Startup"<br/>&nbsp;&nbsp;&nbsp; REG.GetStringValue HKCU, Key &amp; SubKey, Item, Value<br/>&nbsp;&nbsp;&nbsp; If UCase(Right(Value,9))="\LOAD.FAS" Then flag = True<br/>&nbsp; End if<br/>&nbsp; IF flag Then<br/>&nbsp;&nbsp;&nbsp; MsgBox "TB Tools 已在自动加载列表中!"<br/>&nbsp; Else<br/>&nbsp;&nbsp;&nbsp; REG.GetStringValue HKCU, Key &amp; SubKey, "NumStartup", Value<br/>&nbsp;&nbsp;&nbsp; Value = CStr(CInt(Value)+1)<br/>&nbsp;&nbsp;&nbsp; Item = Value &amp; "Startup"<br/>&nbsp;&nbsp;&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "", Value<br/>&nbsp;&nbsp;&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, "NumStartup", Value<br/>&nbsp;&nbsp;&nbsp; REG.SetStringValue HKCU, Key &amp; SubKey, Item, Path<br/>&nbsp;&nbsp;&nbsp; SubKey = "\Applications\AcadAppload"<br/>&nbsp;&nbsp;&nbsp; REG.GetDWORDValue HKCU, Key &amp; SubKey, "LOADCTRLS", Value<br/>&nbsp;&nbsp;&nbsp; Value = Value or 2<br/>&nbsp;&nbsp;&nbsp; REG.SetDWORDValue HKCU, Key &amp; SubKey, "LOADCTRLS", Value<br/>&nbsp;&nbsp;&nbsp; MsgBox "成功加入自动加载列表!"<br/>&nbsp; End if<br/>End if<br/></p><div>该程序为本站下载,想改为非同目录下运行,就是如何做到把(指定加载同目录下的Load.fas文件),改为(指定加载不同目录下的Load.fas文件),即我的*.VBS在D:\AA\kk.VBS,而Load.fas在C:\bb\Load.fas.请高手指导,谢谢!</div>
页: [1]
查看完整版本: 能否将下列程序改为非同目录下运行?