Computing.Net > Forums > Windows XP > DOS equivalent of UNIX 'which'?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

DOS equivalent of UNIX 'which'?

Reply to Message Icon

Name: FritzTheCat
Date: March 26, 2009 at 02:08:39 Pacific
OS: Windows XP
Subcategory: General
Comment:

Is there a DOS/XP equivalent of the UNIX 'which' command? I've found several lists of DOS/UNIX equivalent commands, but which is never among them.



Sponsored Link
Ads by Google

Response Number 1
Name: Ed in Texas.
Date: March 26, 2009 at 02:20:41 Pacific
Reply:

FritzTheCat, 'if/then' or 'if/then/else'?
HTH.
Ed in Texas.


0

Response Number 2
Name: FritzTheCat
Date: March 26, 2009 at 03:09:55 Pacific
Reply:

No, the 'which' command in UNIX is used to find the first location of a file in the current PATH. For example, 'which perl' might return /usr/local/bin/perl.


0

Response Number 3
Name: wanderer
Date: March 26, 2009 at 08:09:33 Pacific
Reply:

closest I think you can get to which is the dir command

c:\>dir filename.ext /s

This will list the file sought and its path. You would have to determine which was the shortest path.


0

Response Number 4
Name: kptech
Date: March 26, 2009 at 12:01:55 Pacific
Reply:

Here's a site that's ported several unix utilities, including "which" to DOS:

http://www.openetwork.com/berk.html...

I tried it and it seems to work...


0

Response Number 5
Name: FritzTheCat
Date: March 26, 2009 at 13:25:27 Pacific
Reply:

Thanks kptech, that's exactly what I needed...lots of other goodies (grep, awk) on that site as well.


0

Related Posts

See More



Response Number 6
Name: jefro
Date: March 26, 2009 at 14:59:10 Pacific
Reply:

See also unix services 3.5. It has many ported tools.

"Best Practices", Event viewer, host file, perfmon, antivirus, anti-spyware, Live CD's, backups, are in my top 10


0

Response Number 7
Name: Mechanix2Go
Date: March 26, 2009 at 23:01:27 Pacific
Reply:

@echo off & setLocal EnableDelayedExpansion

if %1'==' goto :eof

for %%a in (%path%) do (
dir /b %%a | find /i "%1" > nul
if not errorlevel 1 echo %1 is in %%a && goto :eof
)


=====================================
If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: DOS equivalent of UNIX 'which'?

DOS command equivalent of Unix www.computing.net/answers/windows-xp/dos-command-equivalent-of-unix/147145.html

Unix 'Which' equivalent in DOS www.computing.net/answers/windows-xp/unix-which-equivalent-in-dos/112949.html

dualboot www.computing.net/answers/windows-xp/dualboot/18671.html