running windows batch program in perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rohitbasu77
    New Member
    • Feb 2008
    • 89

    running windows batch program in perl

    hi friends,

    need help from you....
    i have a Windows batch program..
    i need to run it from a perl script.....

    regards
    rohit
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by rohitbasu77
    hi friends,

    need help from you....
    i have a Windows batch program..
    i need to run it from a perl script.....

    regards
    rohit

    Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

    My appologies for the delay in getting an answer to your question.

    Regards,

    Jeff

    Comment

    • nithinpes
      Recognized Expert Contributor
      • Dec 2007
      • 410

      #3
      Originally posted by rohitbasu77
      hi friends,

      need help from you....
      i have a Windows batch program..
      i need to run it from a perl script.....

      regards
      rohit
      You can use any of the following ways:
      Code:
      system("C:\\mybatch.bat");
      OR

      Code:
      system("start C:\\mybatch.bat"); ## this will open a new command window
      OR

      Code:
      exec("C:\\mybatch.bat");
      OR

      Code:
      `C:\\mybatch.bat`;  # using backticks(reverse quotes)
      If you want to capture the output, assign it to a variable. For ex:
      Code:
      @res=`C:\\mybatch.bat`;

      Comment

      • rohitbasu77
        New Member
        • Feb 2008
        • 89

        #4
        Originally posted by numberwhun
        Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

        My appologies for the delay in getting an answer to your question.

        Regards,

        Jeff
        no issue Jeff.
        i have got the answer..

        Comment

        • rohitbasu77
          New Member
          • Feb 2008
          • 89

          #5
          Originally posted by nithinpes
          You can use any of the following ways:
          Code:
          system("C:\\mybatch.bat");
          OR

          Code:
          system("start C:\\mybatch.bat"); ## this will open a new command window
          OR

          Code:
          exec("C:\\mybatch.bat");
          OR

          Code:
          `C:\\mybatch.bat`;  # using backticks(reverse quotes)
          If you want to capture the output, assign it to a variable. For ex:
          Code:
          @res=`C:\\mybatch.bat`;

          thanks Nitin. I know it works in unix with perl.
          but whether it work in windows with active perl, i don't know.
          this question was asked to me who works in windows platforn.
          i told how i do it in unix platform to run a shell script within perl.

          Comment

          • nithinpes
            Recognized Expert Contributor
            • Dec 2007
            • 410

            #6
            Originally posted by rohitbasu77
            thanks Nitin. I know it works in unix with perl.
            but whether it work in windows with active perl, i don't know.
            this question was asked to me who works in windows platforn.
            i told how i do it in unix platform to run a shell script within perl.
            It works very well in Windows with Activestate perl. :)

            Comment

            • rohitbasu77
              New Member
              • Feb 2008
              • 89

              #7
              Originally posted by nithinpes
              It works very well in Windows with Activestate perl. :)
              thats great. thanks.

              Comment

              Working...