Hi,i was wondering if i can call a function i have in my Visual Studio project from a batch file
e.g : The function Logoff() from Form1 in my project to be called when the bat file is opened
Call external function from bat file
Moderator: DosItHelp
Re: Call external function from bat file
Depends on your c++ source, and how you compile it, and what you allow for "calling from batch".
It should be possible if you compile your source as dll (and correctly export this function):
(Edit: Should also be possible for VB.NET, but i'm not familiar with this.)
Then you could write a batch/c# hybrid, to compile an executable that calls the above c++ function.
You could also use powershell to call the c# code (which probably compiles an executable temporary).
For both solutions this may be of interest:
http://www.dostips.com/forum/viewtopic.php?p=45441#p45441
penpen
Edit: Added a comment.
It should be possible if you compile your source as dll (and correctly export this function):
Code: Select all
extern "C" __declspec(dllexport) <return type> __cdecl myfunc(<paramlist>) {
// function body
}
Then you could write a batch/c# hybrid, to compile an executable that calls the above c++ function.
You could also use powershell to call the c# code (which probably compiles an executable temporary).
For both solutions this may be of interest:
http://www.dostips.com/forum/viewtopic.php?p=45441#p45441
penpen
Edit: Added a comment.