whereis on NT (windows2000)

Posted on 2001-08-25
Medium Priority
Last Modified: 2008-01-09
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!
Question by:mmcw

Expert Comment

ID: 6424607
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.

Author Comment

ID: 6424621
What do you mean??
LVL 19

Expert Comment

by:Kim Ryan
ID: 6425548
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.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.


Author Comment

ID: 6425961
How to manual locate them on NT?
I am new to NT

Expert Comment

by:christopher sagayam
ID: 6426472
try searching for "perl.exe"


installing "blat.exe" in lieu of sendmail

Author Comment

ID: 6426539
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?
LVL 19

Expert Comment

by:Kim Ryan
ID: 6427180
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.
LVL 19

Expert Comment

by:Kim Ryan
ID: 6430280
Has this helped?

Author Comment

ID: 6430936
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!
LVL 19

Expert Comment

by:Kim Ryan
ID: 6431141
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.

Expert Comment

ID: 6448333
dir \perl* /s

Accepted Solution

PC_User321 earned 200 total points
ID: 6700836
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;




Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question