首页 > 系统服务 > 详细

PowerShell 使用当前日期创建文件夹

时间:2016-06-29 13:32:34      阅读:195      评论:0      收藏:0      [点我收藏+]
$usedate = "{0:yyyy-MM-dd}" -f (Get-Date)   #获取当前计算机日期,并存储为yy-mm-dd格式


$newfile = Get-ChildItem  -name * -include $usedate

if ( $newfile -eq $null ) 
{
    New-Item -Name $usedate -ItemType Directory  #如果当前目录下没有此文件则创建   
}
else
{
    write-host "$newfile 已经存在"
}


本文出自 “汜水流年_” 博客,请务必保留此出处http://timefiles.blog.51cto.com/8475652/1793886

PowerShell 使用当前日期创建文件夹

原文:http://timefiles.blog.51cto.com/8475652/1793886

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!