Results 1 to 6 of 6

Thread: dos commands

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    a few days ago I asked how to run a dos command in VB
    I got this answer but it won't work

    cmd = "cmd /c dir > " & app.path & "\dosresult.txt"


    so I run

    Shell "ping 192.0.0.1 /c dir > c:\test.txt"

    or

    Shell "NSLOOKUP /c dir > c:\test.txt"

    and it doesn't do anything

    Kurt Simons
    [I know I'm a hack but my clients don't!]

  2. #2
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    Hi,

    It's the outputting to a file it doesn't like.

    Create a batchfile that runs the command and shell to this.

    Then you can access the output file.

    Regards

    Chris

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Sorry,

    I don't know what a batch file is!

    Please Advice
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    Batch file is just a file with the ".BAT"


    put this in a file

    ping 192.0.0.1 /c dir > c:\test.txt

    and call the file test.bat

    then run shell "c:\test.bat" from VB
    VB 6 Professional Edition

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Got IT
    Thanks a Billion!!!
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Another question

    How Can I do a multiple command like

    nslookup
    set type=mx
    yahoo.com



    Kurt Simons
    [I know I'm a hack but my clients don't!]

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