Running Insure++ on command line

rerrerrerrer Posts: 9

Hi all,

I am rather new to insure++ and will like to check whether is it possible to run insure++ on a visual studio solution through the command line? If yes how should I go about doing it?

Because now I am only aware of using the IDEs to run the insure++ test


  • RichRich Posts: 19

    The easiest way to do this is to set an environment variable:
    then build your solution:
    devenv /Build foo.sln

    In fact, if you look in the install directory there should be a file named "insdevenv.bat", which does this for you. You use it instead of devenv, and you get what you want.

  • rerrerrerrer Posts: 9

    So I either had to set up an environment variable "INSURE_INSTRUMENT_ALL" with the value "true" first, then build the solution using devenv /Build foo.sln?
    I did this however I didn't receive any notification about insure++ being run, the solution just built per normal.


    I can run "insdevenv.bat" on the solution file? i.e. at cmd>> insdevenv.bat foo.sln? How does this works?

  • RichRich Posts: 19

    For all of this to work, you need to be in a visual studio command-shell, insure++ must be on your PATH. IOW: You should be able to type "insure" on the command-prompt, and see something like this:

          Insure++ Version 7.5.2 (build 2018-11-14)
          Copyright 1993-2018 Parasoft Corporation
          Technical support is available at:
                E-mail:    [email protected]
                Telephone: (626) 305-0041
                Fax:       (626) 305-9048

    You use insdevenv.bat just the same way you'd use devenv to build your application.

    So, if you normally type: devenv /Build foo
    You'd type: insdevenv /Build foo

    There's also a hook in the Insure control panel. On the "General" tab, you'll find a box labeled: "Microsoft Visual C++ Integration", and inside there is a checkbox: "Instrument all builds in Visual C++". If you check that box then you get instrumented builds when you invoke devenv.

    Alternatively, if you want to invoke the compiler, "CL", yourself, then you just make sure that the correct CL is on the path, and invoke "insure" instead

    If you normally type: cl /Zi /EHsc foo.cpp /o foo.exe
    Then you'd type: insure /Zi /EHsc foo.cpp /o foo.exe

    Naturally, adjust things for your command-line.

  • RichRich Posts: 19

    All of the above only refers to BUILDING an instrumented application.
    If it's already built, you can RUN the application from the command-line by using inject.exe or inject_x64.exe (for 64-bit applications)

    If your application is foo.exe, and you normally start foo.exe on the command-line like so:

    C> foo /bar /quux /zork

    Then, you can start an instrumented, (or even non-instrumented), version of foo.exe like so:

    C> inject foo /bar /quux /zork
  • rerrerrerrer Posts: 9

    @Rich Alright. Much thanks for your help

Sign In or Register to comment.