powershell - Command Start-Sleep -milliseconds 50
问题描述
Playing off of someone elses script (i know nothing) is there a way to apply this sleep to a command such as "dir"? Goal: Display DIR output in typewriter effect.
$string = "The quick brown fox jumped over the lazy dog."
$string -split '' |
ForEach-Object{
Write-Host $_ -nonew
Start-Sleep -milliseconds 50
}
解决方案
Get-Item * | ForEach-Object { Write-Output $_; Start-Sleep -milliseconds 50 }
Implementation with dir (Get-Item in Powershell)
Take each line from the output ($_) wait for 50 milliseconds and print the line.
推荐阅读
- reactjs - 惰性反应和 HOC 类型,类型“未知”不可分配给类型“组件类型”
- react-native - 如何在本机反应中实现以下设计?
- ios - 将可选的 @objc 枚举类型传递给 @objc 协议
- firebase - 如何向 Map 类型的地图添加值
? - ios - 如何修复模拟器 Swift xcode 上的视图高度?
- api - 如何在 Swagger 2.0 中处理多个 400 响应
- java - 用户通过 orElseThrow 方法定义的异常
- excel - 从其他列的一列中查找并突出显示选定的连续单元格
- robotframework - PyCharm安装成功后Faker库不提供关键字
- antlr - ANTLR:如何摆脱 'missing NEWLINE at '
''?