英文:
Is there a PowerShell equivalent to the dir /w of the old Windows command prompt?
问题
在旧版的Windows命令提示符中,dir /w
命令以宽格式格式化目录输出,以便更快地查看内容,无需在垂直堆叠的大型输出中滚动以找出文件夹名称。这在使用VS Code集成终端时尤其有用,因为终端窗口的大小通常受限制。PowerShell 有类似的功能吗?
英文:
In the older Windows command prompt dir /w
formatted the directory output in wide format, providing a more at-a-glance view of contents to pick out folder names without having to scroll through the larger output that happens when they are all stacked vertically. This is especially useful when in VS Codes integrated terminal where the terminal window size is often restricted. Does PowerShell have an equivilent?
答案1
得分: 1
cmd /r dir /w
正如上面的评论中DSSO21建议的那样,给我提供了我期望的结果,尽管命令比我想要的更冗长。
英文:
cmd /r dir /w
as suggested by DSSO21 in the Comments above gives me the result I was expecting, albeit a more verbose command than I'd like.
答案2
得分: 0
你追求这个吗?
Get-ChildItem | Select-Object -Property Name
这应该相当于"dir /w",如果我记得正确的话。
英文:
are you after this?
Get-ChildItem | Select-Object -Property Name
It should be an equivalent of "dir /w". If I remember correctly.
答案3
得分: 0
这个最终的、也是我首选的解决方案涉及在我的Powershell配置文件中创建一个函数:
function List-Wide
{
Get-ChildItem | Format-Wide -Column 5
}
然后,在我的配置文件脚本中进一步设置一个别名来调用这个函数:
Set-Alias -Name lsw -Value List-Wide
英文:
This final, and my preferred, solution involves creating a function in my Powershell profile:
function List-Wide
{
Get-ChildItem | Format-Wide -Column 5
}
Then, further down in my profile script, setting an alias to call this function:
Set-Alias -Name lsw -Value List-Wide
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论