• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

whereis on NT (windows2000)

I am using the following commands on a UNIX server:

my $plocation =`whereis perl`;
my $sendmail =`whereis sendmail`;

When I use the same command on a NT (Windows2000) sever I get the following error!

'whereis' is not recognized as an internal or external command, operable program or batch file. 'whereis' is not recognized as an internal or external command, operable program or batch file.

What does it mean?? and how to fix it!
0
mmcw
Asked:
mmcw
1 Solution
 
mrmickyCommented:
UNfortunately, I'm not aware of anything like 'whereis' on NT.

One solution is to write a script that will read your PATH from the environment, search the paths for the program, and output the result to STDOUT.
0
 
mmcwAuthor Commented:
Sorry,
What do you mean??
0
 
Kim RyanIT ConsultantCommented:
whereis is a UNIX only command. If you are running a Perl script, then `whereis perl` seems slightlty redundant. Similialry, sendmail is not available on NT either. It could be easier to do a once only manual location of these programs and the hard ocde them into your program.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mmcwAuthor Commented:
How to manual locate them on NT?
I am new to NT
0
 
christopher sagayamCommented:
try searching for "perl.exe"

and

installing "blat.exe" in lieu of sendmail
0
 
mmcwAuthor Commented:
How to search for perl.exe on NT?
On unix you can use whereis perl!

How to search for blat.exe or how to see if it is installed?
0
 
Kim RyanIT ConsultantCommented:
From the start button on bottom left corner of your screen, select Find->Files or Folders. Then type perl.exe in the Named: field and hit the Find Now button.
0
 
Kim RyanIT ConsultantCommented:
Has this helped?
0
 
mmcwAuthor Commented:
No, it didn't. It is not my own server I am working on.
I am working on someones else server! That's why I use the whereis command in a script. I don't have to ask my provider where the sendmail or perl on blat is!! I want it to find myself!
0
 
Kim RyanIT ConsultantCommented:
Can you do a remote login to the NT server? You could use DOS commands to search the directory tree. Perl could be in somewhere like C:\perl\bin. Also if you type perl -v from the coomand line and a copyright message comes up, then you know perl is installed and its location becomes somewhat redundant.
0
 
hank1Commented:
dir \perl* /s
0
 
PC_User321Commented:
Here is a perl script that perform a similar fuction to 'whereis'.
Name it whereis.bat and put in a directory that is on the search path.  (Type 'set path' at the command prompt to find a suitable place.)
Replace fullPathOfThisScript below with the path chosen (eg C:\WINNT\system32 (although a more appropriate directory would be better)).


@rem = '
@echo off
echo ~
perl -w  fullPathOfThisScript\whereis.bat %1
goto EndOfPerl
';
@rem = 0;

use Env;                    # Import all environment variables into %ENV
Env::import();               # Copy env variables from %ENV to local variables with appropriate names

$pattern = shift;
@paths = split /;/, $ENV{PATH};
($extentionOptions = lc $ENV{PATHEXT}) =~ s/;/|/g;
$extentionOptions =~ s/\./\\./g;

foreach $path (@paths) {
   opendir DIR, $path;
   map {print lc "$path\\$_\n" if /$pattern.*($extentionOptions)$/i} readdir DIR;
   #If you want an exact match then replace the line above with:
   #map {print lc "$path\\$_\n" if /^$pattern($extentionOptions)$/i} readdir DIR;
}

__END__

:EndOfPerl

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now