On Tue, 31 Dec 2002 02:14:18 -0500, you wrote:

>Thanks... thing is, it can be anything from c:\whatever.exe to 
>c:\program files\program name\bin\program.exe.  I'll write a function 
>that goes to each directory in a string and does a dir /x if I have to, 
>but isn't there a simpler way?

I don't know of anything built into PHP.  There is a Win32 API call
called GetShortPathName that would return the information.  Maybe you
can search and find a small binary that makes that API call and
returns it's result.  Another option is to use Perl.  If you can
install ActivePerl on your server you can use the following script:

#!/usr/bin/perl

use strict;
use warnings;
use Win32;
use Getopt::Std;
use File::Basename;

our ($opt_p); getopts('p:'); my $path = $opt_p;

if (!defined($path) || $path eq '') {
  print "Please specify a path with the -p option, for example: ".
         basename($0)." -p \"c:\\my long path\"\n";       
  exit;         
}

my $short_path = Win32::GetShortPathName($path);

print $short_path;
exit 0;

HTH...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to