UPDATE: Bah. This doesnt work. Never mind me. For some reason when you click on the script it gets executed from a console, so the -t tests says true. Wheras if i launch a script from my editor it shows false, so I assumed the same would be true when double-clicking. I shouldnt have assumed..... :-(
Sure, use the -t filetest operation to test if STDIN is connected to a TTY. Try the following script (you might have to change where the log gets written to.)
#!perl -l open my $log,">>C:/tmp/log.log" or die $!; my $term_type=-t STDIN ? "Terminal" : "Non Terminal"; print $log localtime(time)." $term_type"; print localtime(time)." $term_type";
In reply to Re: Determining if a program was run from a command prompt.
by demerphq
in thread Determining if a program was run from a command prompt.
by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |