Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DOS Commands

DOS Commands

Scheduled Pinned Locked Moved Visual Basic
tutoriallinuxhelp
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cberam
    wrote on last edited by
    #1

    Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram

    C Y L A 4 Replies Last reply
    0
    • C cberam

      Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      VB6 or VB.NET ? What commands are you trying to execute ? Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • C cberam

        Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram

        Y Offline
        Y Offline
        Yuvi Panda
        wrote on last edited by
        #3

        Well, if you just want to execute the commands and exit the command line, you can shell cmd with the /c command line switch. For example, if you want to execute the help command,:

        Shell("cmd.exe /c help")

        That would work in both VB6 and VB 05, though it's not the best practice in VB 05... Yuvi Panda T 15 Year old Microsoft Student Partner Blogs at : http://yuvipanda.blogspot.com

        1 Reply Last reply
        0
        • C cberam

          Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          http://www.control.com/1026213519/index_html[^]

          1 Reply Last reply
          0
          • C cberam

            Hi, How to execute DOS commands from VB. I used Shell command but it didn't work.Pls help me with an example. Ram

            A Offline
            A Offline
            Archer282
            wrote on last edited by
            #5

            I always use Process, you can actually redirect the input/output... short example to ping google... Dim ping As New Process ping.StartInfo.Arguments = "www.google.com" ping.StartInfo.CreateNoWindow = True 'this will prevent a window from being created, so the user won't see a flash of a console window opening/closing ping.StartInfo.FileName = "ping" 'whatever program you want to run ping.StartInfo.RedirectStandardOutput = True ' must be set to true if you want to get output ping.StartInfo.UseShellExecute = False ' must be set to false if any of RedirectStandard* members are true ping.Start() 'starts the application MsgBox(ping.StandardOutput.ReadToEnd) 'will msgbox the output of ping

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups