Open Command Prompt Command

SOLVED Discussion in 'Web Design & Coding' started by Comptech, Dec 11, 2011.

  1. Comptech

    Comptech ICT Technican

    Joined:
    Dec 11, 2011
    Messages:
    16
    Likes Received:
    14
    Location:
    UK
    Here is how to open command prompt and keep window open with information already displayed

    Dim Command As String
    Command = "ipconfig /all"
    Shell("cmd /k" & Command, 1, True)

    pleace this in a click event

    Kind Regards

    Bradley
     
    Comptech, Dec 11, 2011
    #1
    Zeus likes this.
    1. Advertisements

  2. Comptech

    AceInfinity Somewhere...

    Joined:
    Aug 13, 2012
    Messages:
    7
    Likes Received:
    0
    Location:
    Canada
    Shell isn't advised in my opinion. You can use the System.IO Process class to do the same thing.

    Code:
    Public Sub MainMethod(cmdName As String)
    	Dim Proc As New Process
    	Dim ProcInfo As New ProcessStartInfo
    	With ProcInfo
    		.FileName = "cmd.exe"
    		.Arguments = String.Format("/k {0}", cmdName)
    		.UseShellExecute = False
    		.Verb = "runas"
    		.WindowStyle = ProcessWindowStyle.Normal
    	End With
    
    	Proc.StartInfo = ProcInfo
    	Proc.Start()
    End Sub
     
    AceInfinity, Aug 13, 2012
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. JEMASCOLA
    Replies:
    11
    Views:
    1,471
  2. James
    Replies:
    0
    Views:
    7,262
    James
    Sep 30, 2004
  3. dehumanizati
    Replies:
    2
    Views:
    1,248
    dehumanizati
    Oct 23, 2004
  4. shivaprasad

    command Prompt

    shivaprasad, Jan 10, 2007, in forum: Software
    Replies:
    7
    Views:
    1,023
    Nickweb
    Jan 13, 2007
  5. Shane Baker

    How to enable command prompt under Win XP?

    Shane Baker, Oct 12, 2004, in forum: Computing
    Replies:
    11
    Views:
    721
    Unknown
    Oct 13, 2004
  6. MisterE
    Replies:
    0
    Views:
    326
    MisterE
    Oct 5, 2007
  7. §ñühw¤£f
    Replies:
    2
    Views:
    555
    §ñühw¤£f
    Apr 19, 2009
  8. Bill

    Undo Elevated Command Prompt

    Bill, May 1, 2011, in forum: DIY Computers
    Replies:
    22
    Views:
    2,674
    Daniel James
    May 6, 2011
Loading...