?
Solved

whereis on NT (windows2000)

Posted on 2001-08-25
12
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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
 
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 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;
}

__END__

:EndOfPerl

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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

771 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