Windows는 어디에 있습니까? 명령 과 동일한 기능이 있습니까? 실제로 실행할 수있는

Windows에 Unix whereis 명령 과 동일한 기능이 있습니까?

실제로 실행할 수있는 명령이 어디 있는지 알아낼 수 있습니다.



답변

곳의 명령은 당신이 원하는 것을 및 Windows 98 리소스 키트에 적어도 돌아갑니다, 및 Server 2003에 기본적으로 포함되어, Vista 및 새로운 :

C:\>where csc
C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe

Vista에서 인수없이 실행하면 내가 좋아하는 메시지 중 하나가 나타납니다.

C:\>where
ERROR: The operation completed successfully.

PowerShell에서 실행하는 경우 경로를 따라 ‘where’별칭 또는 스크립트와 구별되도록 ‘.exe’를 포함해야합니다. ‘where’는 Where-Object.ps1의 일반적인 별칭입니다.

C:\> where.exe where.exe
C:\Windows\System32\where.exe


답변

hackerish which.cmd :

@echo off
@set PATH=.;%PATH%

@rem
@rem about:  something similar like the unix-alike-which, but with
@rem         within pure cmd
@rem

if "%1" == "" (
    @echo Usage:
    @echo.
    @echo   which 'cmd'
    @echo.
    @echo.if 'cmd' is not found, ERRORLEVEL is set to 1
    @echo.
) else (
    ( @for %%f in (%1 %1.exe %1.cmd %1.bat %1.pif) do if not "%%~$PATH:f" == "" ( @echo %%~$PATH:f ) else @set ERRORLEVEL=1)
)


답변

where 명령을 사용하십시오 :

> where app.exe

목표를 달성하는 가장 좋은 방법입니다.

PowerShell 명령을 사용할 수도 있습니다.

> $env:path.Split(';') | gci -Filter app.exe

확장 버전은 다음과 같습니다.

 > $env:path.Split(';') | select -Unique | ? {$_ -and (test-path $_)} | gci -Filter app.exe


답변

어딘가 “아무것도”이 배치 파일을 찾았습니다 whereis.bat.

@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

업데이트 : 어쩌면 여기 에서 찾았습니다 .


답변

이 유틸리티 에는 최소한 Windows 포트which있습니다.


답변

function find ($string) {
   Get-ChildItem -Path 'c:\' -Recurse -Filter $string;
}

function whereis ($string) {
   $superpath = "$env:Path;C:\Program Files;C:\Program Files (x86)";
   (echo $superpath).Split(';') | Get-ChildItem -Recurse -Filter $string;
}

예:

PS> Mozilla.admx 찾기

    Directory: C:\Windows\PolicyDefinitions

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        1/27/2016  12:22 PM          37146 Mozilla.admx

PS> whereis firefox.exe

    Directory: C:\Program Files\Mozilla Firefox

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        9/21/2017   5:30 PM         477136 firefox.exe


답변

나는 오늘 이것을 찾고 있었고 리소스 키트가없는 XP를 사용하고 있기 때문에 다음 명령으로 powershell을 사용했습니다.

dir -path c:\ -filter ffmpeg.* -r