run .cmd file through vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyanka1915
    New Member
    • Nov 2007
    • 32

    run .cmd file through vb.net

    i want to run .cmd file through vb.net

    Please help urgently
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    Try something like this in VB

    ProcessStartInf o psi = new ProcessStartInf o("FileName") ;
    Process p = new Process();
    p.StartInfo = psi;
    p.Start();

    Comment

    • priyanka1915
      New Member
      • Nov 2007
      • 32

      #3
      Originally posted by mzmishra
      Try something like this in VB

      ProcessStartInf o psi = new ProcessStartInf o("FileName") ;
      Process p = new Process();
      p.StartInfo = psi;
      p.Start();
      thanks but actually this code is used to run the.exe file and i want to run .cmd file.....

      Comment

      • mzmishra
        Recognized Expert Contributor
        • Aug 2007
        • 390

        #4
        I think it should run the .cmd file too.
        See the below link.It says the file name does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system.


        http://msdn2.microsoft .com/en-us/library/h6ak8zt5.aspx

        Comment

        • priyanka1915
          New Member
          • Nov 2007
          • 32

          #5
          Hey Thanks, I'll check n come back to you....
          thanks for ur help

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            The process class is used to start any process, regardless of type.
            You could use it to run a .DOC file, provided a program is associated with that filename extention (MS Word perhaps)

            Comment

            • priyanka1915
              New Member
              • Nov 2007
              • 32

              #7
              Hey its not working....

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                What code are you using to run it?
                We've had no trouble doing this, perhaps you are just missing something small?

                Please post the relevant code.

                Comment

                Working...