linux查找文件路徑的命令,Windows中查找命令的路徑 (類似Linux中的which命令)

 2023-10-08 阅读 24 评论 0

摘要:2019獨角獸企業重金招聘Python工程師標準>>> Linux有個Which命令,用來查找可執行文件的位置。 linux查找文件路徑的命令?例如:which find, 就會從PATH變量的路徑里搜索該命令,返回找到的第一個匹配的結果。 這樣我們就可以知道,

2019獨角獸企業重金招聘Python工程師標準>>> hot3.png

Linux有個Which命令,用來查找可執行文件的位置。

linux查找文件路徑的命令?例如:which find, 就會從PATH變量的路徑里搜索該命令,返回找到的第一個匹配的結果。

這樣我們就可以知道,我們用的find程序是哪里的。

Windows沒有這樣的指令,我們可以自己寫一個:

@echo off
echo %~dp$PATH:1
@echo on

linux復制文件命令。

?

其它的方法:

apropos命令。
1.where is a direct equivalent:
C:\Users\Joey>where cmd
C:\Windows\System32\cmd.exe

Note that in PowerShell where itself is an alias for Where-Object, thus you need to usewhere.exe in PowerShell.


2.In cmd you can also use for:
C:\Users\Joey>for %x in (powershell.exe) do @echo %~$PATH:x
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

whereis命令,
3.In PowerShell you have Get-Command and its alias gcm which does the same if you pass an argument (but also works for aliases, cmdlets and functions in PowerShell):
PS C:\Users\Joey> Get-Command where

CommandType???? Name????????? Definition
-----------???? ----????????? ----------
Alias?????????? where???????? Where-Object
Application???? where.exe???? C:\Windows\system32\where.exe

The first returned command is the one that would be executed.

?

轉自網絡。

?

轉載于:https://my.oschina.net/lenglingx/blog/693381

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/2/131744.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息