Try it out:
sub GetExeLocation()
{
my $i;
my $MyPath = $0;
my @MyPathArray = split(/\\/,$MyPath);
for($i=0 ; $i<scalar(@MyPathArray)-1 ; $i++)
{
$ExeLocation .= $MyPathArray[$i]."\\";
};
chop ($ExeLocation);
}
It works for me. I'm compiled this into exe using perl2exe.
Good luck,
Nahum
On 6/23/06, Foo JH
<[EMAIL PROTECTED]> wrote:
Hi all,
It's like this: I built an executable using PerlSvc, and I install the
service like this:
c:\app\test.exe --install
In Services, the 'Path to Execute' field shows:
c:\app\test.exe
But when I start the service, and I print out the current working
directory, it's:
C:/WINDOWS/system32
I suspect the packaged executable unpacks itself somewhere, and runs the
script in that other directory. How can I get the path where the
application is stored (ie. c:\app\)?
One way is to add it to the argument of the service, which should work,
but it's not as elegant...
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
