web-development-kb-ko.site

Windows의 위치와 동등한가요?

Windows에서 Unix whereis 명령과 동등한 명령이 있습니까?

그래서 내가 실제로 실행할 수있는 명령이 어디인지 알 수 있습니다.

160
Svish

명령은 원하는 것을 수행하고 Windows 98 용 리소스 키트로 돌아가며 Server 2003, Vista 및 Windows Server 2003에 기본적으로 포함되어 있습니다. 최신 :

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에서 실행하는 경우 '.exe'를 포함시켜 경로의 별칭 또는 스크립트와 구별하십시오. ( 'Where'는 Where-Object.ps1의 일반적인 별칭입니다.)

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

제발, 사용 어디 명령 :

> where app.exe

목표 달성을위한 최선의 방법입니다.

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

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

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

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

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) 
)
7
akira

어딘가에 "저기에"이 whereis.bat 파일을 찾았습니다 :

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

업데이트 : 어쩌면 나는 그것을 발견했다 여기 .

3
Craig McQueen

which 유틸리티에는 적어도 Windows 포트 가 있습니다.

2
innaM
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        
1
Rupert

저는 오늘 이것을 찾고 있었고 자원 키트가 없어도 XP에 있었기 때문에 다음 명령으로 powershell을 사용했습니다 :

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

다른 (GUI) 접근 방식이지만 모든 것을 보십시오.

0
name