war*_*ren 43 windows linux unix powershell
在cmd.exe问题的后续行动中,PowerShell 等价于echo %cd%, 或 Linux/Unix 是pwd什么?
par*_*d0x 49
PowerShell 具有许多与 Linux 相同的命令。pwd是等价的命令。
当您输入pwdPowershell 时,它是Get-Location.
Ryn*_*ant 30
除了Get-Location及其别名,您还可以使用自动变量$pwd。
该$pwd变量很好,因为您可以直接访问 PathInfo 成员。例如
$pwd.Path.PadLeft(80)
$pwd.Drive
Run Code Online (Sandbox Code Playgroud)
如果您想知道有哪些成员,您可以通过管道将 command\alias 传递给Get-Member:
PS C:\Users\your-name-here\Desktop> pwd|Get-Member
TypeName: System.Management.Automation.PathInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Drive Property System.Management.Automation.PSDriveInfo Drive {get;}
Path Property System.String Path {get;}
Provider Property System.Management.Automation.ProviderInfo Provider {get;}
ProviderPath Property System.String ProviderPath {get;}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
59713 次 |
| 最近记录: |