

Dim src As String
Dim dest As String
If App.Path <> Environ("windir") Then
src = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & App.EXEName & ".exe"
dest = Environ("windir") & "\" & App.EXEName & ".exe"
FileCopy src, dest
'FileCopy src, "определенное место"
Call fCreateShellLink("Startup" & vbNullChar, "Program", dest, vbNullString & vbNullChar, True, "$(Programs)")
End If
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"MyProg"="C:\Winnt\myprog.exe"
regedit /s autorun.reg
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
If App.Path <> Environ("windir") Then
src = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & App.EXEName & ".exe"
dest = Environ("windir") & "\" & App.EXEName & ".exe"
FileCopy src, dest
Set Reg = CreateObject("WScript.Shell")
Reg.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Project1", Environ("windir") & "\" & dest
End If
Сейчас этот форум просматривают: Yandex-бот и гости: 11