none
How to call C# dll from a batch file? RRS feed

  • Question

  • Hi All,

        As per the requirement I have written a C# code to access Active Directory and to fetch required data and to store it in a database. But this has to be scheduled everyday at the specific time. So I thought to create a batch file which can scheduled as well, but I stuck up with a question that can we call C# dll from a batch file? If we can how to achieve it? Please suggests me if anybody knows about this!


    Cheers, Chetan
    Monday, October 25, 2010 4:46 AM

Answers

  • Hey Ray, eh might not be any use to you now, maybe it might, but Powershell is perfect for this. It has AD stuff build in (or at least it will be able to use your DLL)

    Might require an install though :/

    Powershell is pretty good.


    …we each have more potential than we might ever presume to guess. (Blog: http://dsmyth.blogspot.com/)
    • Marked as answer by eryang Friday, November 5, 2010 9:09 AM
    Monday, October 25, 2010 10:00 AM

All replies

  • Why not just make it an exe? or write a quick app that calls the dll?
    Monday, October 25, 2010 5:19 AM
  • Hi Ray M

        Thanks for your reply. Here I have to make the application automated that should run on daily scheduled at specific time.

    (Agenda : Fetching data from Activedirectory to database on daily schedule)

    What I have done:-

        I have already created one windows service that runs a timer internally. As per my thinking in windows one timer will be running by default. So instead of creating a another timer in our custom service thought to create a batch file that will execute the dll. We can schedule the task of executing the batch file by adding on scheduled task in windows.

    What has to be done:-

        Scheduling the batch file that will run the code automatically.


    Cheers, Chetan
    Monday, October 25, 2010 6:23 AM
  • Well that didn't clear anything up. What does this service has to do with anything? Can you explain why my previous suggestions will not work for you?
    Monday, October 25, 2010 9:46 AM
  • Hey Ray, eh might not be any use to you now, maybe it might, but Powershell is perfect for this. It has AD stuff build in (or at least it will be able to use your DLL)

    Might require an install though :/

    Powershell is pretty good.


    …we each have more potential than we might ever presume to guess. (Blog: http://dsmyth.blogspot.com/)
    • Marked as answer by eryang Friday, November 5, 2010 9:09 AM
    Monday, October 25, 2010 10:00 AM