LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

launched from a windows command line

If my labview app is run remotely from a windows command line, is there any way to tell programmatically from a variable somewhere that it was launched by another app and not by the operator manually launching the app itself ?

0 Kudos
Message 1 of 2
(1,951 Views)

Hello id,

 

If you have control over the application that's invoking your exe through the command line, I'd suggest using a simple custom argument that is passed to the application per this KnowledgeBase:

 

KnowledgeBase 1CNFGHFI: Passing Command Line Arguments to a LabVIEW Executable

http://digital.ni.com/public.nsf/allkb/17C3AD70493CE0208625666A00763364

 

You would then use the App.Args property (Application:Command Line Arguments Property) to check for your "this launched from the command line via this other application" argument, whatever it might be. I would suggest that you should only need to check for *any* arguments, if they're present then you know it's been launched via the command line. The argument could just be the name of the calling application.  If you're unable to insert arguments via the invoking application, you could also use a one-line batch file that's installed with the target EXE to do the same thing (you'd run the batch file instead of the executable from the invoking application).

 

Determining where an application was invoked from without sending it that information explicitly is another, trickier problem- there are plenty of discussions on stackexchange and elsewhere detailing possible solutions, but if the invoked application (your EXE) isn't owned by the command prompt process I'm not sure it's possible.  There are a few mentions of checking environment variables that the command prompt usually sets to see if they've been configured, but I have no experience with this.

 

Best Regards,

Tom L.
Message 2 of 2
(1,939 Views)