Results 1 to 10 of 10

Thread: Simple question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    67

    Cool Simple question

    Could you please tell me how to do the following:
    Copy and Execute a program from vb code? for example:

    I want user to click test.exe, then i want test.exe to make a copy of itself and put it in c:\program files\testfolder. Thanks.

    Also, how do you move, copy, paste and delete files? Not just exes, i mean jpg, txt whatever. Thanks

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    You can make a refrence to the microsoft runtime library and then do the following
    It's a little messy.
    VB Code:
    1. Dim objFSO As New FileSystemObject
    2.    Dim objFolder As Folder
    3.    Dim sDestination As String
    4.    Dim sSource As String
    5.    
    6.    sDestination = "C:\program Files\testfolder\"
    7.    sSource = App.Path
    8.    Set objFSO = New FileSystemObject
    9.     If Not objFSO.FolderExists(sDestination) Then
    10.         objFSO.CreateFolder (sDestination)
    11.     End If
    12.    
    13.     objFSO.CopyFolder sSource, sDestination, True

  3. #3
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    Again, jjortiz, there's an easier way. (remembers last time...)

    VB Code:
    1. FileCopy [i][Source][/i], [i][Destination][/i]

  4. #4
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    I know. Bad habits die hard. What can i say. Now remind me, but does Filecopy support UNC paths?

  5. #5
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    Never tried.

    Maybe you can test it out.

  6. #6
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555
    Originally posted by jjortiz
    Now remind me, but does Filecopy support UNC paths?
    Yes!
    Mindcrime : )
    ICQ 24003332

    VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8

  7. #7
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Originally posted by jjortiz
    I know. Bad habits die hard. What can i say. Now remind me, but does Filecopy support UNC paths?
    I know im dumb, but whats a UNC path? A path with wildcards?
    You just proved that sig advertisements work.

  8. #8
    A network path, like

    \\yourcomputer\yourshare\subdirectory\file.doc

  9. #9
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Ohok, thanks Arien.
    You just proved that sig advertisements work.

  10. #10
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    It's a network path uniform network something i assume. I forgot what resolves the addresses on an NT network. I think its wins if i am not wrong.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width