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. C#
  4. Execute a *.bat file in C# project

Execute a *.bat file in C# project

Scheduled Pinned Locked Moved C#
csharphelpannouncement
8 Posts 3 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
    CodingLover
    wrote on last edited by
    #1

    Hi all, On the release mode only, when build the project I want to execute a bat file. That bat file do another process. What I've try is add the bat file name as the command argument in project property as pre-build event command line. But it not works for me. Can anyone comments on this. Thanks you.

    I appreciate your help all the time... CodingLover :)

    A A 2 Replies Last reply
    0
    • C CodingLover

      Hi all, On the release mode only, when build the project I want to execute a bat file. That bat file do another process. What I've try is add the bat file name as the command argument in project property as pre-build event command line. But it not works for me. Can anyone comments on this. Thanks you.

      I appreciate your help all the time... CodingLover :)

      A Offline
      A Offline
      Ajit Shekhawat
      wrote on last edited by
      #2

      May be this works, because author is executing bat file in this article using post build event. http://www.highoncoding.com/Articles/398_Using%20Post-Build%20Event%20to%20Execute%20Unit%20Tests.aspx[^]

      1 Reply Last reply
      0
      • C CodingLover

        Hi all, On the release mode only, when build the project I want to execute a bat file. That bat file do another process. What I've try is add the bat file name as the command argument in project property as pre-build event command line. But it not works for me. Can anyone comments on this. Thanks you.

        I appreciate your help all the time... CodingLover :)

        A Offline
        A Offline
        ABitSmart
        wrote on last edited by
        #3

        Something like this,

        if $(ConfigurationName) == Release yourbatchfile.bat

        C 1 Reply Last reply
        0
        • A ABitSmart

          Something like this,

          if $(ConfigurationName) == Release yourbatchfile.bat

          C Offline
          C Offline
          CodingLover
          wrote on last edited by
          #4

          Actually I don;t want to run the project. Only in the build, compile, I want to run the .bat file. I've set the properties on post-build event command line as follows. call $(ProjectDir)build_help.bat It calls the bat file correctly. But it's not execute. bat content like this. echo compiling help documentation "C:\Program Files\HTML Help Workshop\hhc.exe" Help.hhp echo done. error is, Unable to open Help.hhp But when I double click on the bat file it works fine.

          I appreciate your help all the time... CodingLover :)

          A 1 Reply Last reply
          0
          • C CodingLover

            Actually I don;t want to run the project. Only in the build, compile, I want to run the .bat file. I've set the properties on post-build event command line as follows. call $(ProjectDir)build_help.bat It calls the bat file correctly. But it's not execute. bat content like this. echo compiling help documentation "C:\Program Files\HTML Help Workshop\hhc.exe" Help.hhp echo done. error is, Unable to open Help.hhp But when I double click on the bat file it works fine.

            I appreciate your help all the time... CodingLover :)

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

            Try specifying the file path for "Help.hhp", absolute path or place "Help.php" in the release/debug folder(whichever you are currently building on)

            C 1 Reply Last reply
            0
            • A ABitSmart

              Try specifying the file path for "Help.hhp", absolute path or place "Help.php" in the release/debug folder(whichever you are currently building on)

              C Offline
              C Offline
              CodingLover
              wrote on last edited by
              #6

              Seems it's fine. But now the case is I've to place all html files and stuff in bin folder too.

              I appreciate your help all the time... CodingLover :)

              A 1 Reply Last reply
              0
              • C CodingLover

                Seems it's fine. But now the case is I've to place all html files and stuff in bin folder too.

                I appreciate your help all the time... CodingLover :)

                A Offline
                A Offline
                ABitSmart
                wrote on last edited by
                #7

                You can copy then back to where you want with a batch file :-D Did it not work with an absolute path ?

                C 1 Reply Last reply
                0
                • A ABitSmart

                  You can copy then back to where you want with a batch file :-D Did it not work with an absolute path ?

                  C Offline
                  C Offline
                  CodingLover
                  wrote on last edited by
                  #8

                  As I said earlier once the command is call $(ProjectDir)build_help.bat ask to add bat file into the bin folder. If I added bat file into the bin, I have to change all paths.

                  I appreciate your help all the time... CodingLover :)

                  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