'========================================================================== ' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1 ' ' NAME: add2run03.vbs ' ' AUTHOR: shile ' DATE : 2008-12-13 ' ' COMMENT: vbs實現添加程序到自啟動項 ' '========================================================================== On Error Resume Next '出錯繼續執行下個命令 dim ws Set ws=CreateObject("Wscript.Shell") Dim runKey,runPath runKey = InputBox("輸入自啟動項鍵值名稱","請輸入") runPath = InputBox("輸入相應的程序路徑","請輸入") Dim temp,ret temp = ws.RegRead("HKLM/Software/Microsoft/Windows/CurrentVersion/Run/"&runKey) 'MsgBox temp If temp <> Empty Then ret = MsgBox( "鍵值"&runKey"已經存在,其值為"&temp",是否替換為新的值"&runPath, vbOKCancel, "提示!") If ret = vbOK Then ws.RegWrite "HKLM/Software/Microsoft/Windows/CurrentVersion/Run/"&runKey,runPath MsgBox "修改"&runKey"值為"&runPath"成功",vbYes,"恭喜!" End If Else ws.RegWrite "HKLM/Software/Microsoft/Windows/CurrentVersion/Run/"&runKey,runPath MsgBox "添加"&runKey"<"&runPath">成功",vbYes,"恭喜!" End If