Results 1 to 4 of 4

Thread: Run a command in the commandprompt

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343
    I was wondering if it's possible to send a command line from VB to the command prompt or the run command on the start menu and then run it?

    /Smirre

    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  2. #2
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    use the shell function to call a program-

    shell "c:\program.exe"

    Regards

    Chris
    VB6 VS2005

  3. #3
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    If you need to, you can also use Shell to run DOS commands. So, to use the DOS Copy command you could do this.

    Code:
    Shell "command.com /c copy c:\file1.txt + c:\file2.txt c:\file3.txt"

  4. #4
    Guest
    When using the Shell function, you should set it's window style too or else, its going to be loaded, but no focus.

    vbHide
    vbNormalFocus
    vbMinimizedFocus
    vbMaximizedFocus
    vbNormalNoFocus
    vbMinimizedNoFocus

    Shell(pathname[, windowstyle])

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