Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004

    Unanswered: DOS command in VB - help me

    Dear All

    i want to run DOS Command through VB like Delete file

    kindly help me


  2. #2
    Join Date
    Aug 2004
    If you want to delete files then I suggest you use the KILL command as such

    Kill <filename>

    As for other purposes you can use the Shell command but whatever you call with this command must be an EXE file so you cannot actually use the DEL command with SHELL. This command is used this way :

    Shell "c:\myprogram.exe", vbNormalFocus


  3. #3
    Join Date
    Jul 2001
    check your help disk for "FileSystemObject Object". With FSO, you can copy, delete, create and move files/folders, among other goodies. I've used it to generate text-based webpages in the background and backup and restore MSAccess, Oracle and MySQL databases.

    dim fso as object
    set fso as createobject("scripting.filesystemobject")

    'to copy a file:
    fso.copyfile <source path\filename.ext>,<destination path\filename.ext>

    'to delete a file
    fso.deletefile <file path\filename.ext>, <force>
    'where force = True or False, depending if you wish to delete readonly files.

Posting Permissions

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