首頁>Club>
12
回覆列表
  • 1 # fhemf22843

    Sub RegRun() On Error Resume Next Dim wsh As Object Set wsh=CreateObject("Wscript.Shell") wsh.regwrite "HKLM\Software\Microsoft\Windows\Currentversion\Run\" & App.Exename, App.Path & Iif(Len(App.Path)=3, "", "\") & App.Exename & ".exe","REG_SZ" End Subsub RegRun() on error resume next dim wsh set wsh=createobject("wscript.shell") wsh.regwrite "HKLM\Software\Microsoft\Windows\Currentversion\Run\" & app.exename,app.path & "\" & app.exename & ".exe",REG_SZ" end sub 只要執行regrun這個過程,就會把自己寫入啟動項 wsh.regwrite 三部分意義: wsh.regwrite 寫入的位置,寫入的值,寫入的型別 HKLM\Software\Microsoft\Windows\Currentversion\Run\ 是啟動項的位置也叫鍵名,值的名稱任意,值的內容為要啟動的程式的路徑 比如你要把IE寫入啟動項,就這樣寫 wsh.regwrite "HKLM\Software\Microsoft\Windows\Currentversion\Run\IE","C:\Program Files\Internet Explorer\IExplorer.exe","REG_SZ" 前面那段程式碼就是把程式自身寫入啟動項的 "隨系統啟動而執行 Dim hKey As Long, SubKey As String, Exe As String SubKey = "Software\Microsoft\Windows\CurrentVersion\Run" Exe = MyPath & "ComputerManul.exe" "要啟動的程式 RegCreateKey HKEY_CURRENT_USER, SubKey, hKey RegSetValueEx hKey, "計算機維護程式V1.1", 0, REG_SZ, ByVal Exe, _ LenB(StrConv(Exe, vbFromUnicode)) + 1 RegCloseKey hKey

  • 中秋節和大豐收的關聯?
  • 臉上的面板凹凸不平怎麼辦?