Y a-t-il un équivalent de 39; qui suivait#39 sur la ligne de commande Windows

Mots clés : windowscommand-linepath-variableswindows

meilleur 5 Réponses Y a-t-il un équivalent de 39; qui suivait#39 sur la ligne de commande Windows

vote vote


Set-Alias which where.exe 
gcm notepad* 
vote vote


c:\> for %i in (cmd.exe) do @echo.   %~$PATH:i    C:\WINDOWS\system32\cmd.exe  c:\> for %i in (python.exe) do @echo.   %~$PATH:i    C:\Python25\python.exe 
@echo off setlocal enableextensions enabledelayedexpansion  :: Needs an argument.  if "x%1"=="x" (     echo Usage: which ^<progName^>     goto :end )  :: First try the unadorned filenmame.  set fullspec= call :find_it %1  :: Then try all adorned filenames in order.  set mypathext=!pathext! :loop1     :: Stop if found or out of extensions.      if "x!mypathext!"=="x" goto :loop1end      :: Get the next extension and try it.      for /f "delims=;" %%j in ("!mypathext!") do set myext=%%j     call :find_it %1!myext!  :: Remove the extension (not overly efficient but it works).  :loop2     if not "x!myext!"=="x" (         set myext=!myext:~1!         set mypathext=!mypathext:~1!         goto :loop2     )     if not "x!mypathext!"=="x" set mypathext=!mypathext:~1!      goto :loop1 :loop1end  :end endlocal goto :eof  :: Function to find and print a file in the path.  :find_it     for %%i in (%1) do set fullspec=%%~$PATH:i     if not "x!fullspec!"=="x" @echo.   !fullspec!     goto :eof 
vote vote


$ Get-Command eventvwr  CommandType   Name          Definition -----------   ----          ---------- Application   eventvwr.exe  c:\windows\system32\eventvwr.exe Application   eventvwr.msc  c:\windows\system32\eventvwr.msc 
$ sal which gcm   # short form of `Set-Alias which Get-Command` $ which foo ... 
$ gcm *disk*  CommandType     Name                             Version    Source -----------     ----                             -------    ------ Alias           Disable-PhysicalDiskIndication    Storage Alias           Enable-PhysicalDiskIndication    Storage Function        Add-PhysicalDisk           Storage Function        Add-VirtualDiskToMaskingSet    Storage Function        Clear-Disk                 Storage Cmdlet          Get-PmemDisk               PersistentMemory Cmdlet          New-PmemDisk               PersistentMemory Cmdlet          Remove-PmemDisk            PersistentMemory Application     diskmgmt.msc               C:\WINDOWS\system32\diskmgmt.msc Application     diskpart.exe                     10.0.17... C:\WINDOWS\system32\diskpart.exe Application     diskperf.exe                     10.0.17... C:\WINDOWS\system32\diskperf.exe Application     diskraid.exe                     10.0.17... C:\WINDOWS\system32\diskraid.exe ... 
$ $Env:PATHEXT="$Env:PATHEXT;.dll;.ps1;.psm1;.py"     # temporary assignment, only for this shell's process  $ gcm user32,kernel32,*WASM*,*http*py  CommandType     Name                        Version    Source -----------     ----                        -------    ------ ExternalScript  Invoke-WASMProfiler.ps1                C:\WINDOWS\System32\WindowsPowerShell\v1.0\Invoke-WASMProfiler.ps1 Application     http-server.py        C:\Users\ME\AppData\Local\Microsoft\WindowsApps\http-server.py Application     kernel32.dll                10.0.17... C:\WINDOWS\system32\kernel32.dll Application     user32.dll                  10.0.17... C:\WINDOWS\system32\user32.dll 
vote vote


set-alias which where.exe 
vote vote


($Env:Path).Split(";") | Get-ChildItem -filter programName* 

Questions similaires