Sure. Try this:
Code:Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 ' Maintenance string for PSS usage End Type Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Const VER_PLATFORM_WIN32_NT = 2 Private Const VER_PLATFORM_WIN32_WINDOWS = 1 Private Sub Command1_Click() Dim os As OSVERSIONINFO Dim strWindDir As String Dim lngRet As Long Dim strDestination As String Dim strSource As String 'Change the filename to the appropriate one strSource = "C:\MyFile.exe" os.dwOSVersionInfoSize = 148 os.szCSDVersion = Space$(128) lngRet = GetVersionEx(os) strWindDir = Space(255) 'Get Windows Directory lngRet = GetWindowsDirectory(strWindDir, Len(strWindDir)) If lngRet Then strWindDir = Left(strWindDir, lngRet) 'Check the Operating System Select Case os.dwPlatformId Case VER_PLATFORM_WIN32_NT strDestination = strWindDir & "\Profiles\All Users\Start Menu\Programs\Startup" Case VER_PLATFORM_WIN32_WINDOWS strDestination = strWindDir & "\Startup" End Select 'Copy your file FileCopy strSource, strDestination End Sub




Reply With Quote