在Powershell中相当于* Nix'which'命令? [英] Equivalent of *Nix 'which' command in Powershell?

查看:977
本文介绍了在Powershell中相当于* Nix'which'命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何询问powershell什么地方吗?

例如哪个记事本,它根据当前路径返回运行notepad.exe的目录。

解决方案

当我开始在powershell中定制我的配置文件时,第一个别名是'which'。

 获取命令的新别名

要将其添加到您的个人资料中,请输入:

  n新 - 别名,其获取命令| add-content $ profile 

`n是为了确保它将作为新行开始。 p>

Does anyone know how to ask powershell where something is?
For instance "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.

解决方案

The very first alias I made once I started customizing my profile in powershell was 'which'.

New-Alias which get-command

To add this to your profile, type this:

"`nNew-Alias which get-command" | add-content $profile

The `n is to ensure it will start as a new line.

这篇关于在Powershell中相当于* Nix'which'命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆