• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

What is an equivalent of which on the Windows command line?

by admin

On the Windows command line, the equivalent of the Linux/Unix “which” command is the “where” command. The “where” command can be used to locate the path of an executable file that is specified in the command line.

For example, if you want to find the path of the “java” executable, you can run the following command:

where java

This will display the full path of the “java” executable file, if it exists in any of the directories that are listed in the system’s PATH environment variable. If the executable file is not found, then the command will not return any output.

The “where” command can also be used with wildcards to search for files that match a specific pattern. For example, to find all executable files that start with the letter “p”, you can run the following command:

where p*.exe

This will display the full path of all executable files that match the pattern “p*.exe”.

Examples

1. Find all files named ‘Zappa’ on the remote computer ‘Server64’ by searching the subdirectories of Share1:

C:\> WHERE /r \\Server64\Share1 Zappa.*

2. List all the files in the Demo folder:

C:\> WHERE "C:\demo\:*.*"

3. List all the .CSV files on both the work and play folders:

C:\> WHERE C:\work\;C:\Play\:*.csv

4. In PowerShell, find all copies of robocopy.exe in the current system path:

PS C:\> WHERE.exe robocopy.exe

Summary

The “where” command in Windows is a command-line utility that helps you locate the path of an executable file that matches the name you specify. It is similar to the Linux/Unix “which” command.

Filed Under: Linux, Windows

Some more articles you might also be interested in …

  1. CentOS / RHEL 6,7 : How to disable or delete virbr0 interface
  2. How to enable IPv6 on CentOS / RHEL 6
  3. nixos-rebuild Command Examples in Linux
  4. How to Change the filesystem Labels in CentOS/RHEL
  5. How to Configure Existing Lvm Volume Group to Use DM-Multipath
  6. guake Command Examples in Linux
  7. httpie Command Examples in Linux
  8. flash Command Examples in Linux
  9. CentOS / RHEL : How to find which user run a specific command?
  10. CentOS / RHEL 7 : How to disable IPv6 on a specific interface only

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright