Launch Command Line

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • critter
    Forum Member
    • Dec 2005
    • 13

    Launch Command Line

    How can you launch a command line or DOS prompt?
    File.Run("c:\windows\system32\cmd.exe", "", "", SW_SHOWNORMAL, false);
    Does not seem to work.
  • longedge
    Indigo Rose Customer
    • Aug 2003
    • 2496

    #2
    This works for me in a button on click -

    Code:
    result = File.Run("cmd.exe", "", "", SW_SHOWNORMAL, false);
    p.s. - you have to escape backslashes i.e. -

    File.Run("c:\\windows\\system32\\cmd.exe", "", "", SW_SHOWNORMAL, false);
    Last edited by longedge; 05-08-2006, 03:03 PM.

    Comment

    • critter
      Forum Member
      • Dec 2005
      • 13

      #3
      Thanks! Works great. It's always something simple.
      Now for another question. Can you launch a specific command, such as "ipconfig" from the command line and do all of this with a single button click? One button click: open command line, run ipconfig.

      Comment

      • longedge
        Indigo Rose Customer
        • Aug 2003
        • 2496

        #4
        Originally posted by critter
        Can you launch a specific command, such as "ipconfig" from the command line and do all of this with a single button click? One button click: open command line, run ipconfig.
        Yes certainly, my own preference is to make a batch file and then run that. One of the reason I use this method is because I could never succesfully incorporate command line parameters - the correct syntax always eludes me . If I can find a moment later, I'll post an example.

        Comment

        • critter
          Forum Member
          • Dec 2005
          • 13

          #5
          Thanks!!! That would be awesome and greatly appreciated.

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2496

            #6
            OK try this - it has 3 buttons each runs a different .bat and I've put a 'pause' at the end to stop the dos window closing.

            You could incorporate a pipe command to direct output from the batch file to another text file and then after a 'wait' load the resultant text file into a paragraph object to keep it all inside the AMS app.

            Comment

            Working...
            X