powershell - 解析日期文件夹

标签 powershell

我有在其中部署Windows服务的文件夹。此文件夹中的每个部署都会使用名称适当的当前日期和时间创建一个新文件夹,然后从该文件夹中重新安装win服务。
http://screencast.com/t/gprp0ph2Mks
我如何定义上一个部署文件夹的物理路径?

最佳答案

如果我理解您的问题,则要从D:\ projects \ ru \ service获取第二个最近的文件夹。

你可以这样做:

(dir -path D:\projects\ru\service | ? {$_.PsIsContainer} | sort LastWriteTime)[-2].FullName

关于powershell - 解析日期文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9157695/

相关文章:

Azure AD 应用程序注册 secret 操纵

powershell - 将输入变量从批处理文件发送到 powershell 脚本

powershell - 在 Powershell 中,是否有比自定义对象更好的方法来存储/查找 n 维数组中的数据

string - 获取 .trim/-trim、.replace/-replace、.split/-split 和其他字符串运算符的帮助

powershell - AzureRm从创建的虚拟机获取IP

powershell - Powershell,获取虚拟机的ip4v地址

powershell - 如何修复 Powershell 中的日期格式以使用 ISO 8601

windows - 通过 Powershell 添加 JAVA_HOME 到系统变量 Path

Powershell Hyper-V 脚本不起作用? + 自动安装 Windows

powershell - 如何为Powershell脚本修复歧义参数