[Tips] Window 和 Linux 下查找文件命令

本文介绍了在Windows环境下使用WHERE命令进行文件搜索的方法,包括基本语法、参数解释及实例应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Windows 下:

用where:

usage:


WHERE [/R dir] [/Q] [/F] [/T] pattern...


Description:
    Displays the location of files that match the search pattern.
    By default, the search is done along the current directory and
    in the paths specified by the PATH environment variable.


Parameter List:
    /R       Recursively searches and displays the files that match the
             given pattern starting from the specified directory.


    /Q       Returns only the exit code, without displaying the list
             of matched files. (Quiet mode)


    /F       Displays the matched filename in double quotes.


    /T       Displays the file size, last modified date and time for all
             matched files.


    pattern  Specifies the search pattern for the files to match.
             Wildcards * and ? can be used in the pattern. The
             "$env:pattern" and "path:pattern" formats can also be
             specified, where "env" is an environment variable and
             the search is done in the specified paths of the "env"
             environment variable. These formats should not be used
             with /R. The search is also done by appending the
             extensions of the PATHEXT variable to the pattern.


     /?      Displays this help message.


  NOTE: The tool returns an error level of 0 if the search is
        successful, of 1 if the search is unsuccessful and
        of 2 for failures or errors.


Examples:
    WHERE /?
    WHERE myfilename1 myfile????.*
    WHERE $windir:*.* 
    WHERE /R c:\windows *.exe *.dll *.bat  
    WHERE /Q ??.??? 
    WHERE "c:\windows;c:\windows\system32:*.dll"
    WHERE /F /T *.dll 


example:

where /r "c:\test" *.js


Linux :

用 find 命令

usage:

find . -name "*.js"




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值