Решите/разрешите filepath/alias определенной команды в командной строке Windows

Как я могу узнать, к которому filepath (или псевдоним) определенный ввод команд укажет на в командной строке Windows? Специфически Windows XP, информация о других версиях также ценится!

В системах Unix я просто использую:

$ which commandname
/a/commandname

Или:

$ type -a commandname
commandname is aliased to `/b/commandname'
commandname is /a/commandname
commandname is /b/commandname

И я просто ищу эквивалент в Windows Shell (конкретно Победа XP).


Я пришел к этому общему вопросу от конкретного вопроса: Я установил robocopy.exe (версия 026), но командная строка "robocopy" всегда инициировала версию 010, и я хотел бы определить, где эта команда указывает на для исправления этой ошибки.

2
задан 08.02.2011, 13:12

1 ответ

Я нашел этот простой пакетный файл Windows:

@echo off
rem --------------------------------------------------------
rem File: which.cmd
rem Description: Windows equivalent of Unix which command
rem Author: Pankaj Kumar
rem Copyright 2004 Pankaj Kumar. All Rights Reserved.
rem License: This software is available under GPL
rem ---------------------------------------------------------
setlocal
if "%1" == "" goto noArg

set fullpath=%~$PATH:1
if "%fullpath%" == "" goto notFound
echo Found in PATH: %fullpath%
goto end

:noArg
echo No Argument specified
goto end

:notFound
echo Argument "%1" not found in PATH

:end
endlocal

От help for:

%~$PATH:I   - searches the directories listed in the PATH  
               environment variable and expands %I to the  
               fully qualified name of the first one found.  
               If the environment variable name is not  
               defined or the file is not found by the  
               search, then this modifier expands to the  
               empty string`
0
ответ дан 12.12.2019, 00:18

Теги

Похожие вопросы