Solved

whereis on NT (windows2000)

Posted on 2001-08-25
12
220 Views
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!
0
Comment
Question by:mmcw
12 Comments
 
LVL 1

Expert Comment

by:mrmicky
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.
0
 

Author Comment

by:mmcw
ID: 6424621
Sorry,
What do you mean??
0
 
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.
0
 

Author Comment

by:mmcw
ID: 6425961
How to manual locate them on NT?
I am new to NT
0
 
LVL 6

Expert Comment

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

and

installing "blat.exe" in lieu of sendmail
0
 

Author Comment

by:mmcw
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?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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.
0
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 6430280
Has this helped?
0
 

Author Comment

by:mmcw
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!
0
 
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.
0
 
LVL 1

Expert Comment

by:hank1
ID: 6448333
dir \perl* /s
0
 
LVL 5

Accepted Solution

by:
PC_User321 earned 50 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;
}

__END__

:EndOfPerl

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now