windows – PowerShell相当于BASH(etc)’type’命令?
发布时间:2020-12-14 01:47:17 所属栏目:Windows 来源:网络整理
导读:在* nix上,使用BASH(等)通过使用内置的’type’ shell,询问系统命令所在的位置(等): $type catcat is /bin/cat Microsoft PowerShell 2.0中是否存在等效的“类型”命令? 相当于Get-Command. PS C: Get-Command lsCommandType Name Definition-----------
在* nix上,使用BASH(等)通过使用内置的’type’
shell,询问系统命令所在的位置(等):
$type cat cat is /bin/cat Microsoft PowerShell 2.0中是否存在等效的“类型”命令?
相当于Get-Command.
PS C:&; Get-Command ls CommandType Name Definition ----------- ---- ---------- Alias ls Get-ChildItem Application ls.exe D:usrlocalwbinls.exe Application ls.exe C:Program Files (x86)Gitbinls.exe Windows 10更新: 由于我发布了这个答案,看来Get-Command的行为已经改变了.要包含所有结果(以Un * x的样式),现在我需要传递-All标志,如下所示: PS C:&; Get-Command -All ls CommandType Name Version Source ----------- ---- ------- ------ Alias ls -> Get-ChildItem Application ls.exe 0.0.0.0 C:Program Files (x86)Gitusrbinls.exe 如评论中所述,这不包括“定义”列,就像之前的行为一样.我无法确定添加定义列的命令行参数,但正如@voutasaurus在下面的注释中所指出的,可以使用: PS C:&; (Get-Command -All ls).Definition Get-ChildItem C:Program Files (x86)Gitusrbinls.exe 版本信息供参考(我没有与原始答案文本相关的版本信息,但我猜它是Windows 7): PS C:&; [System.Environment]::OSVersion.Version Major Minor Build Revision ----- ----- ----- -------- 10 0 15063 0 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows上的Ubuntu上的Bash中的Lxss文件夹缺少
- 使程序开机自启
- WIX烧毁卸载?
- windows – 使用组策略加入无线网络时,是否可以指定WPA2密码
- Windows10:Opencv4.0+Opencv4.0.1_contrib编译
- windows – 用于打印图片的命令行工具?
- 更新到最新的Windows 10 ADMX文件会导致问题吗?
- windows-server-2008 – Windows Server 2008 R2映射用户特
- windows-phone-8 – 使用LongListSelector进行连续分页
- 在Windows Mobile 6,Windows Phone 7,Android和iPhone上编写