in reply to caller of perl script
If you know it is going to be started from one of these two places, why not have them pass that information in to you?
It is relatively simple (on win, with the right module) to get the parent process id and name, but that isn't going to be very helpful as the name will be cmd.exe! And the command line will be either blank, or however that copy of cmd was started.
This because .bat files are processed by the current running instance of cmd.exe, not a new instance, so the name of the .bat file is never a part of any command line, unless it was start as cmd /c the.bat
|
|---|